Difference between revisions of "WISE-PaaS/OTA Agent(Android)"

From ESS-WIKI
Jump to: navigation, search
Line 40: Line 40:
 
return;
 
return;
 
}
 
}
 
                // first verify package
 
/*
 
        try {
 
                mWakelock.acquire();
 
                RecoverySystem.verifyPackage(recoveryFile, recoveryVerifyListener, null);
 
        } catch (IOException e1) {
 
                reportInstallError(OTAStateChangeListener.ERROR_PACKAGE_VERIFY_FALIED);
 
                e1.printStackTrace();
 
                return;
 
        } catch (GeneralSecurityException e1) {
 
                reportInstallError(OTAStateChangeListener.ERROR_PACKAGE_VERIFY_FALIED);
 
                e1.printStackTrace();
 
                return;
 
        } finally {
 
                mWakelock.release();
 
        }
 
*/
 
 
RecoverySystem.installPackage(mContext, recoveryFile);
 
RecoverySystem.installPackage(mContext, recoveryFile);
 
break;
 
break;

Revision as of 05:54, 4 November 2016

Introduction

This document demonstrates how to support our ota-agent solution under your android system.This demonstration is android 4.3 based. If you encounter problem under your some-versio android system,please mailto me: jin.xin@advantech.com.cn

Architecture

RTENOTITLE

The android ota solution is compose of two parts: the C-lanuage  based Ota-agent and the Java-language based OtaService.

  • Ota-agent achieves communiction with the ota-server, besides, it achieves the package download and unzip. But, the Ota-agent is C-language based and it can't invoke the Java-language based android OTA APIs, so the OtaService comes.
  • OtaService is on the android framework layer, so it can invoke the android OTA APIs directly. The OtaService provides as a socket server. So the Ota-agent can invoke the android OTA APIs through the socket connnect providing by OTaService indirectly.

Android OtaService

we now support four commands, you can  extent your commands.


switch(Advaction.getAdvaction(asplit[0])){	
						case systembackup:
							Slog.i(TAG, "switch systembackup");
							RecoverySystem.rebootSystemBackup(mContext);
							break;
						case wipedata:
							Slog.i(TAG, "switch wipedata");
							RecoverySystem.rebootWipeUserData(mContext);
							break;
						case wipecache:
							Slog.i(TAG, "swtich wipecache");
							RecoverySystem.rebootWipeCache(mContext);
							break;
						case install:
							Slog.i(TAG, "switch install");
							String file = asplit[1].trim();
							Slog.i(TAG, "install file: " + file);
							File recoveryFile = new File(file);
                					if(!recoveryFile.exists()){
								Slog.i(TAG, "install, file not exist");
								return;
							}
							RecoverySystem.installPackage(mContext, recoveryFile);
							break;
						default:
							Slog.i(TAG, "error paramer");
							break;		
						}
The source code is here:

Android OtaService test tools

Android Ota-agent