Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7e47ae8 authored by Tao Bao's avatar Tao Bao
Browse files

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
parent c6f0d15c
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -31568,12 +31568,13 @@ package android.os {
  public class UpdateEngine {
    ctor public UpdateEngine();
    method public void applyPayload(java.lang.String, long, long, java.lang.String[]) throws android.os.RemoteException;
    method public boolean bind(android.os.UpdateEngineCallback, android.os.Handler) throws android.os.RemoteException;
    method public boolean bind(android.os.UpdateEngineCallback) throws android.os.RemoteException;
    method public void cancel() throws android.os.RemoteException;
    method public void resume() throws android.os.RemoteException;
    method public void suspend() throws android.os.RemoteException;
    method public void applyPayload(java.lang.String, long, long, java.lang.String[]);
    method public boolean bind(android.os.UpdateEngineCallback, android.os.Handler);
    method public boolean bind(android.os.UpdateEngineCallback);
    method public void cancel();
    method public void resetStatus();
    method public void resume();
    method public void suspend();
  }
  public static final class UpdateEngine.ErrorCodeConstants {
+40 −11
Original line number Diff line number Diff line
@@ -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 {
            }
        };

        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 {
    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 {
    public void cancel() {
        try {
            mUpdateEngine.cancel();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    @SystemApi
    public void suspend() throws RemoteException {
    public void suspend() {
        try {
            mUpdateEngine.suspend();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    @SystemApi
    public void resume() throws RemoteException {
    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();
        }
    }
}