diff options
| author | Tao Bao <tbao@google.com> | 2016-03-22 12:30:23 -0700 |
|---|---|---|
| committer | Tao Bao <tbao@google.com> | 2016-03-22 16:16:34 -0700 |
| commit | b7e47ae84f6fbfb082f5a286db2e5f0bae50c1a1 (patch) | |
| tree | f2d67d3d4d14fabb3fff69449ef81a3dead640b6 /core/java/android/os/UpdateEngine.java | |
| parent | c6f0d15c7d5599f2c13b586ca9c93613a099795d (diff) | |
UpdateEngine: Add resetStatus() as system API.
It calls update engine to reset an already applied payload.
Also change all the RemoteExceptions in UpdateEngine class to be
rethrown as RuntimeExceptions according to API guidelines [FW9].
Bug: 27123767
Change-Id: I936331019cdb00f4f225f5605e51cc94bb491e24
Diffstat (limited to 'core/java/android/os/UpdateEngine.java')
| -rw-r--r-- | core/java/android/os/UpdateEngine.java | 51 |
1 files changed, 40 insertions, 11 deletions
diff --git a/core/java/android/os/UpdateEngine.java b/core/java/android/os/UpdateEngine.java index 80e61462873f..bf03cce947e2 100644 --- a/core/java/android/os/UpdateEngine.java +++ b/core/java/android/os/UpdateEngine.java @@ -87,7 +87,7 @@ public class UpdateEngine { } @SystemApi - public boolean bind(final UpdateEngineCallback callback, final Handler handler) throws RemoteException { + public boolean bind(final UpdateEngineCallback callback, final Handler handler) { IUpdateEngineCallback updateEngineCallback = new IUpdateEngineCallback.Stub() { @Override public void onStatusUpdate(final int status, final float percent) { @@ -118,31 +118,60 @@ public class UpdateEngine { } }; - return mUpdateEngine.bind(updateEngineCallback); + try { + return mUpdateEngine.bind(updateEngineCallback); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } } @SystemApi - public boolean bind(final UpdateEngineCallback callback) throws RemoteException { + public boolean bind(final UpdateEngineCallback callback) { return bind(callback, null); } @SystemApi - public void applyPayload(String url, long offset, long size, String[] headerKeyValuePairs) throws RemoteException { - mUpdateEngine.applyPayload(url, offset, size, headerKeyValuePairs); + public void applyPayload(String url, long offset, long size, String[] headerKeyValuePairs) { + try { + mUpdateEngine.applyPayload(url, offset, size, headerKeyValuePairs); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } } @SystemApi - public void cancel() throws RemoteException { - mUpdateEngine.cancel(); + public void cancel() { + try { + mUpdateEngine.cancel(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } } @SystemApi - public void suspend() throws RemoteException { - mUpdateEngine.suspend(); + public void suspend() { + try { + mUpdateEngine.suspend(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } } @SystemApi - public void resume() throws RemoteException { - mUpdateEngine.resume(); + public void resume() { + try { + mUpdateEngine.resume(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + @SystemApi + public void resetStatus() { + try { + mUpdateEngine.resetStatus(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } } } |
