Loading api/current.txt +4 −5 Original line number Diff line number Diff line Loading @@ -8686,7 +8686,7 @@ package android.content.pm { method public java.util.List<android.content.pm.PackageInstaller.SessionInfo> getAllSessions(); method public java.util.List<android.content.pm.PackageInstaller.SessionInfo> getMySessions(); method public android.content.pm.PackageInstaller.SessionInfo getSessionInfo(int); method public android.content.pm.PackageInstaller.Session openSession(int); method public android.content.pm.PackageInstaller.Session openSession(int) throws java.io.IOException; method public void registerSessionCallback(android.content.pm.PackageInstaller.SessionCallback); method public void registerSessionCallback(android.content.pm.PackageInstaller.SessionCallback, android.os.Handler); method public void uninstall(java.lang.String, android.content.IntentSender); Loading Loading @@ -8719,16 +8719,15 @@ package android.content.pm { method public java.lang.String[] getNames() throws java.io.IOException; method public java.io.InputStream openRead(java.lang.String) throws java.io.IOException; method public java.io.OutputStream openWrite(java.lang.String, long, long) throws java.io.IOException; method public void setProgress(float); method public void setStagingProgress(float); } public static abstract class PackageInstaller.SessionCallback { ctor public PackageInstaller.SessionCallback(); method public abstract void onActiveChanged(int, boolean); method public abstract void onBadgingChanged(int); method public abstract void onClosed(int); method public abstract void onCreated(int); method public abstract void onFinished(int, boolean); method public abstract void onOpened(int); method public abstract void onProgressChanged(int, float); } Loading @@ -8741,7 +8740,7 @@ package android.content.pm { method public java.lang.String getInstallerPackageName(); method public float getProgress(); method public int getSessionId(); method public boolean isOpen(); method public boolean isActive(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; } core/java/android/content/pm/IPackageInstallerCallback.aidl +1 −2 Original line number Diff line number Diff line Loading @@ -20,8 +20,7 @@ package android.content.pm; oneway interface IPackageInstallerCallback { void onSessionCreated(int sessionId); void onSessionBadgingChanged(int sessionId); void onSessionOpened(int sessionId); void onSessionActiveChanged(int sessionId, boolean active); void onSessionProgressChanged(int sessionId, float progress); void onSessionClosed(int sessionId); void onSessionFinished(int sessionId, boolean success); } core/java/android/content/pm/PackageInstaller.java +75 −44 Original line number Diff line number Diff line Loading @@ -304,9 +304,12 @@ public class PackageInstaller { * Open an existing session to actively perform work. To succeed, the caller * must be the owner of the install session. */ public @NonNull Session openSession(int sessionId) { public @NonNull Session openSession(int sessionId) throws IOException { try { return new Session(mInstaller.openSession(sessionId)); } catch (RuntimeException e) { ExceptionUtils.maybeUnwrapIOException(e); throw e; } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } Loading Loading @@ -363,7 +366,7 @@ public class PackageInstaller { public @NonNull List<SessionInfo> getAllSessions() { final ApplicationInfo info = mContext.getApplicationInfo(); if ("com.google.android.googlequicksearchbox".equals(info.packageName) && info.versionCode <= 300400070) { && info.versionCode <= 300400110) { Log.d(TAG, "Ignoring callback request from old prebuilt"); return Collections.EMPTY_LIST; } Loading Loading @@ -436,26 +439,31 @@ public class PackageInstaller { public abstract void onBadgingChanged(int sessionId); /** * Session has been opened. A session is usually opened when the * installer is actively writing data. * Active state for session has been changed. * <p> * A session is considered active whenever there is ongoing forward * progress being made, such as the installer holding an open * {@link Session} instance while streaming data into place, or the * system optimizing code as the result of * {@link Session#commit(IntentSender)}. * <p> * If the installer closes the {@link Session} without committing, the * session is considered inactive until the installer opens the session * again. */ public abstract void onOpened(int sessionId); public abstract void onActiveChanged(int sessionId, boolean active); /** * Progress for given session has been updated. * <p> * Note that this progress may not directly correspond to the value * reported by {@link PackageInstaller.Session#setProgress(float)}, as * the system may carve out a portion of the overall progress to * represent its own internal installation work. * reported by * {@link PackageInstaller.Session#setStagingProgress(float)}, as the * system may carve out a portion of the overall progress to represent * its own internal installation work. */ public abstract void onProgressChanged(int sessionId, float progress); /** * Session has been closed. */ public abstract void onClosed(int sessionId); /** * Session has completely finished, either with success or failure. */ Loading @@ -467,10 +475,9 @@ public class PackageInstaller { Handler.Callback { private static final int MSG_SESSION_CREATED = 1; private static final int MSG_SESSION_BADGING_CHANGED = 2; private static final int MSG_SESSION_OPENED = 3; private static final int MSG_SESSION_ACTIVE_CHANGED = 3; private static final int MSG_SESSION_PROGRESS_CHANGED = 4; private static final int MSG_SESSION_CLOSED = 5; private static final int MSG_SESSION_FINISHED = 6; private static final int MSG_SESSION_FINISHED = 5; final SessionCallback mCallback; final Handler mHandler; Loading @@ -482,24 +489,23 @@ public class PackageInstaller { @Override public boolean handleMessage(Message msg) { final int sessionId = msg.arg1; switch (msg.what) { case MSG_SESSION_CREATED: mCallback.onCreated(msg.arg1); mCallback.onCreated(sessionId); return true; case MSG_SESSION_BADGING_CHANGED: mCallback.onBadgingChanged(msg.arg1); mCallback.onBadgingChanged(sessionId); return true; case MSG_SESSION_OPENED: mCallback.onOpened(msg.arg1); case MSG_SESSION_ACTIVE_CHANGED: final boolean active = msg.arg2 != 0; mCallback.onActiveChanged(sessionId, active); return true; case MSG_SESSION_PROGRESS_CHANGED: mCallback.onProgressChanged(msg.arg1, (float) msg.obj); return true; case MSG_SESSION_CLOSED: mCallback.onClosed(msg.arg1); mCallback.onProgressChanged(sessionId, (float) msg.obj); return true; case MSG_SESSION_FINISHED: mCallback.onFinished(msg.arg1, msg.arg2 != 0); mCallback.onFinished(sessionId, msg.arg2 != 0); return true; } return false; Loading @@ -516,8 +522,9 @@ public class PackageInstaller { } @Override public void onSessionOpened(int sessionId) { mHandler.obtainMessage(MSG_SESSION_OPENED, sessionId, 0).sendToTarget(); public void onSessionActiveChanged(int sessionId, boolean active) { mHandler.obtainMessage(MSG_SESSION_ACTIVE_CHANGED, sessionId, active ? 1 : 0) .sendToTarget(); } @Override Loading @@ -526,11 +533,6 @@ public class PackageInstaller { .sendToTarget(); } @Override public void onSessionClosed(int sessionId) { mHandler.obtainMessage(MSG_SESSION_CLOSED, sessionId, 0).sendToTarget(); } @Override public void onSessionFinished(int sessionId, boolean success) { mHandler.obtainMessage(MSG_SESSION_FINISHED, sessionId, success ? 1 : 0) Loading Loading @@ -567,7 +569,7 @@ public class PackageInstaller { // TODO: remove this temporary guard once we have new prebuilts final ApplicationInfo info = mContext.getApplicationInfo(); if ("com.google.android.googlequicksearchbox".equals(info.packageName) && info.versionCode <= 300400070) { && info.versionCode <= 300400110) { Log.d(TAG, "Ignoring callback request from old prebuilt"); return; } Loading Loading @@ -629,10 +631,22 @@ public class PackageInstaller { mSession = session; } /** {@hide} */ @Deprecated public void setProgress(float progress) { setStagingProgress(progress); } /** * Set current progress. Valid values are anywhere between 0 and 1. * Set current progress of staging this session. Valid values are * anywhere between 0 and 1. * <p> * Note that this progress may not directly correspond to the value * reported by {@link SessionCallback#onProgressChanged(int, float)}, as * the system may carve out a portion of the overall progress to * represent its own internal installation work. */ public void setProgress(float progress) { public void setStagingProgress(float progress) { try { mSession.setClientProgress(progress); } catch (RemoteException e) { Loading Loading @@ -986,7 +1000,7 @@ public class PackageInstaller { /** {@hide} */ public boolean sealed; /** {@hide} */ public boolean open; public boolean active; /** {@hide} */ public int mode; Loading @@ -1010,7 +1024,7 @@ public class PackageInstaller { resolvedBaseCodePath = source.readString(); progress = source.readFloat(); sealed = source.readInt() != 0; open = source.readInt() != 0; active = source.readInt() != 0; mode = source.readInt(); sizeBytes = source.readLong(); Loading @@ -1036,20 +1050,37 @@ public class PackageInstaller { /** * Return current overall progress of this session, between 0 and 1. * <p> * Note that this progress may not directly correspond to the value reported * by {@link PackageInstaller.Session#setProgress(float)}, as the system may * carve out a portion of the overall progress to represent its own internal * installation work. * Note that this progress may not directly correspond to the value * reported by * {@link PackageInstaller.Session#setStagingProgress(float)}, as the * system may carve out a portion of the overall progress to represent * its own internal installation work. */ public float getProgress() { return progress; } /** * Return if this session is currently open. * Return if this session is currently active. * <p> * A session is considered active whenever there is ongoing forward * progress being made, such as the installer holding an open * {@link Session} instance while streaming data into place, or the * system optimizing code as the result of * {@link Session#commit(IntentSender)}. * <p> * If the installer closes the {@link Session} without committing, the * session is considered inactive until the installer opens the session * again. */ public boolean isActive() { return active; } /** {@hide} */ @Deprecated public boolean isOpen() { return open; return isActive(); } /** Loading Loading @@ -1105,7 +1136,7 @@ public class PackageInstaller { dest.writeString(resolvedBaseCodePath); dest.writeFloat(progress); dest.writeInt(sealed ? 1 : 0); dest.writeInt(open ? 1 : 0); dest.writeInt(active ? 1 : 0); dest.writeInt(mode); dest.writeLong(sizeBytes); Loading services/core/java/com/android/server/pm/PackageInstallerService.java +8 −20 Original line number Diff line number Diff line Loading @@ -897,10 +897,9 @@ public class PackageInstallerService extends IPackageInstaller.Stub { private static class Callbacks extends Handler { private static final int MSG_SESSION_CREATED = 1; private static final int MSG_SESSION_BADGING_CHANGED = 2; private static final int MSG_SESSION_OPENED = 3; private static final int MSG_SESSION_ACTIVE_CHANGED = 3; private static final int MSG_SESSION_PROGRESS_CHANGED = 4; private static final int MSG_SESSION_CLOSED = 5; private static final int MSG_SESSION_FINISHED = 6; private static final int MSG_SESSION_FINISHED = 5; private final RemoteCallbackList<IPackageInstallerCallback> mCallbacks = new RemoteCallbackList<>(); Loading Loading @@ -945,15 +944,12 @@ public class PackageInstallerService extends IPackageInstaller.Stub { case MSG_SESSION_BADGING_CHANGED: callback.onSessionBadgingChanged(sessionId); break; case MSG_SESSION_OPENED: callback.onSessionOpened(sessionId); case MSG_SESSION_ACTIVE_CHANGED: callback.onSessionActiveChanged(sessionId, (boolean) msg.obj); break; case MSG_SESSION_PROGRESS_CHANGED: callback.onSessionProgressChanged(sessionId, (float) msg.obj); break; case MSG_SESSION_CLOSED: callback.onSessionClosed(sessionId); break; case MSG_SESSION_FINISHED: callback.onSessionFinished(sessionId, (boolean) msg.obj); break; Loading @@ -968,18 +964,14 @@ public class PackageInstallerService extends IPackageInstaller.Stub { obtainMessage(MSG_SESSION_BADGING_CHANGED, sessionId, userId).sendToTarget(); } private void notifySessionOpened(int sessionId, int userId) { obtainMessage(MSG_SESSION_OPENED, sessionId, userId).sendToTarget(); private void notifySessionActiveChanged(int sessionId, int userId, boolean active) { obtainMessage(MSG_SESSION_ACTIVE_CHANGED, sessionId, userId, active).sendToTarget(); } private void notifySessionProgressChanged(int sessionId, int userId, float progress) { obtainMessage(MSG_SESSION_PROGRESS_CHANGED, sessionId, userId, progress).sendToTarget(); } private void notifySessionClosed(int sessionId, int userId) { obtainMessage(MSG_SESSION_CLOSED, sessionId, userId).sendToTarget(); } public void notifySessionFinished(int sessionId, int userId, boolean success) { obtainMessage(MSG_SESSION_FINISHED, sessionId, userId, success).sendToTarget(); } Loading Loading @@ -1022,18 +1014,14 @@ public class PackageInstallerService extends IPackageInstaller.Stub { writeSessionsAsync(); } public void onSessionOpened(PackageInstallerSession session) { mCallbacks.notifySessionOpened(session.sessionId, session.userId); public void onSessionActiveChanged(PackageInstallerSession session, boolean active) { mCallbacks.notifySessionActiveChanged(session.sessionId, session.userId, active); } public void onSessionProgressChanged(PackageInstallerSession session, float progress) { mCallbacks.notifySessionProgressChanged(session.sessionId, session.userId, progress); } public void onSessionClosed(PackageInstallerSession session) { mCallbacks.notifySessionClosed(session.sessionId, session.userId); } public void onSessionFinished(PackageInstallerSession session, boolean success) { mCallbacks.notifySessionFinished(session.sessionId, session.userId, success); synchronized (mSessions) { Loading services/core/java/com/android/server/pm/PackageInstallerSession.java +3 −3 Original line number Diff line number Diff line Loading @@ -227,7 +227,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { mResolvedBaseFile.getAbsolutePath() : null; info.progress = mProgress; info.sealed = mSealed; info.open = mOpenCount.get() > 0; info.active = mOpenCount.get() > 0; info.mode = params.mode; info.sizeBytes = params.sizeBytes; Loading Loading @@ -833,14 +833,14 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { public void open() { if (mOpenCount.getAndIncrement() == 0) { mCallback.onSessionOpened(this); mCallback.onSessionActiveChanged(this, true); } } @Override public void close() { if (mOpenCount.decrementAndGet() == 0) { mCallback.onSessionClosed(this); mCallback.onSessionActiveChanged(this, false); } } Loading Loading
api/current.txt +4 −5 Original line number Diff line number Diff line Loading @@ -8686,7 +8686,7 @@ package android.content.pm { method public java.util.List<android.content.pm.PackageInstaller.SessionInfo> getAllSessions(); method public java.util.List<android.content.pm.PackageInstaller.SessionInfo> getMySessions(); method public android.content.pm.PackageInstaller.SessionInfo getSessionInfo(int); method public android.content.pm.PackageInstaller.Session openSession(int); method public android.content.pm.PackageInstaller.Session openSession(int) throws java.io.IOException; method public void registerSessionCallback(android.content.pm.PackageInstaller.SessionCallback); method public void registerSessionCallback(android.content.pm.PackageInstaller.SessionCallback, android.os.Handler); method public void uninstall(java.lang.String, android.content.IntentSender); Loading Loading @@ -8719,16 +8719,15 @@ package android.content.pm { method public java.lang.String[] getNames() throws java.io.IOException; method public java.io.InputStream openRead(java.lang.String) throws java.io.IOException; method public java.io.OutputStream openWrite(java.lang.String, long, long) throws java.io.IOException; method public void setProgress(float); method public void setStagingProgress(float); } public static abstract class PackageInstaller.SessionCallback { ctor public PackageInstaller.SessionCallback(); method public abstract void onActiveChanged(int, boolean); method public abstract void onBadgingChanged(int); method public abstract void onClosed(int); method public abstract void onCreated(int); method public abstract void onFinished(int, boolean); method public abstract void onOpened(int); method public abstract void onProgressChanged(int, float); } Loading @@ -8741,7 +8740,7 @@ package android.content.pm { method public java.lang.String getInstallerPackageName(); method public float getProgress(); method public int getSessionId(); method public boolean isOpen(); method public boolean isActive(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; }
core/java/android/content/pm/IPackageInstallerCallback.aidl +1 −2 Original line number Diff line number Diff line Loading @@ -20,8 +20,7 @@ package android.content.pm; oneway interface IPackageInstallerCallback { void onSessionCreated(int sessionId); void onSessionBadgingChanged(int sessionId); void onSessionOpened(int sessionId); void onSessionActiveChanged(int sessionId, boolean active); void onSessionProgressChanged(int sessionId, float progress); void onSessionClosed(int sessionId); void onSessionFinished(int sessionId, boolean success); }
core/java/android/content/pm/PackageInstaller.java +75 −44 Original line number Diff line number Diff line Loading @@ -304,9 +304,12 @@ public class PackageInstaller { * Open an existing session to actively perform work. To succeed, the caller * must be the owner of the install session. */ public @NonNull Session openSession(int sessionId) { public @NonNull Session openSession(int sessionId) throws IOException { try { return new Session(mInstaller.openSession(sessionId)); } catch (RuntimeException e) { ExceptionUtils.maybeUnwrapIOException(e); throw e; } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } Loading Loading @@ -363,7 +366,7 @@ public class PackageInstaller { public @NonNull List<SessionInfo> getAllSessions() { final ApplicationInfo info = mContext.getApplicationInfo(); if ("com.google.android.googlequicksearchbox".equals(info.packageName) && info.versionCode <= 300400070) { && info.versionCode <= 300400110) { Log.d(TAG, "Ignoring callback request from old prebuilt"); return Collections.EMPTY_LIST; } Loading Loading @@ -436,26 +439,31 @@ public class PackageInstaller { public abstract void onBadgingChanged(int sessionId); /** * Session has been opened. A session is usually opened when the * installer is actively writing data. * Active state for session has been changed. * <p> * A session is considered active whenever there is ongoing forward * progress being made, such as the installer holding an open * {@link Session} instance while streaming data into place, or the * system optimizing code as the result of * {@link Session#commit(IntentSender)}. * <p> * If the installer closes the {@link Session} without committing, the * session is considered inactive until the installer opens the session * again. */ public abstract void onOpened(int sessionId); public abstract void onActiveChanged(int sessionId, boolean active); /** * Progress for given session has been updated. * <p> * Note that this progress may not directly correspond to the value * reported by {@link PackageInstaller.Session#setProgress(float)}, as * the system may carve out a portion of the overall progress to * represent its own internal installation work. * reported by * {@link PackageInstaller.Session#setStagingProgress(float)}, as the * system may carve out a portion of the overall progress to represent * its own internal installation work. */ public abstract void onProgressChanged(int sessionId, float progress); /** * Session has been closed. */ public abstract void onClosed(int sessionId); /** * Session has completely finished, either with success or failure. */ Loading @@ -467,10 +475,9 @@ public class PackageInstaller { Handler.Callback { private static final int MSG_SESSION_CREATED = 1; private static final int MSG_SESSION_BADGING_CHANGED = 2; private static final int MSG_SESSION_OPENED = 3; private static final int MSG_SESSION_ACTIVE_CHANGED = 3; private static final int MSG_SESSION_PROGRESS_CHANGED = 4; private static final int MSG_SESSION_CLOSED = 5; private static final int MSG_SESSION_FINISHED = 6; private static final int MSG_SESSION_FINISHED = 5; final SessionCallback mCallback; final Handler mHandler; Loading @@ -482,24 +489,23 @@ public class PackageInstaller { @Override public boolean handleMessage(Message msg) { final int sessionId = msg.arg1; switch (msg.what) { case MSG_SESSION_CREATED: mCallback.onCreated(msg.arg1); mCallback.onCreated(sessionId); return true; case MSG_SESSION_BADGING_CHANGED: mCallback.onBadgingChanged(msg.arg1); mCallback.onBadgingChanged(sessionId); return true; case MSG_SESSION_OPENED: mCallback.onOpened(msg.arg1); case MSG_SESSION_ACTIVE_CHANGED: final boolean active = msg.arg2 != 0; mCallback.onActiveChanged(sessionId, active); return true; case MSG_SESSION_PROGRESS_CHANGED: mCallback.onProgressChanged(msg.arg1, (float) msg.obj); return true; case MSG_SESSION_CLOSED: mCallback.onClosed(msg.arg1); mCallback.onProgressChanged(sessionId, (float) msg.obj); return true; case MSG_SESSION_FINISHED: mCallback.onFinished(msg.arg1, msg.arg2 != 0); mCallback.onFinished(sessionId, msg.arg2 != 0); return true; } return false; Loading @@ -516,8 +522,9 @@ public class PackageInstaller { } @Override public void onSessionOpened(int sessionId) { mHandler.obtainMessage(MSG_SESSION_OPENED, sessionId, 0).sendToTarget(); public void onSessionActiveChanged(int sessionId, boolean active) { mHandler.obtainMessage(MSG_SESSION_ACTIVE_CHANGED, sessionId, active ? 1 : 0) .sendToTarget(); } @Override Loading @@ -526,11 +533,6 @@ public class PackageInstaller { .sendToTarget(); } @Override public void onSessionClosed(int sessionId) { mHandler.obtainMessage(MSG_SESSION_CLOSED, sessionId, 0).sendToTarget(); } @Override public void onSessionFinished(int sessionId, boolean success) { mHandler.obtainMessage(MSG_SESSION_FINISHED, sessionId, success ? 1 : 0) Loading Loading @@ -567,7 +569,7 @@ public class PackageInstaller { // TODO: remove this temporary guard once we have new prebuilts final ApplicationInfo info = mContext.getApplicationInfo(); if ("com.google.android.googlequicksearchbox".equals(info.packageName) && info.versionCode <= 300400070) { && info.versionCode <= 300400110) { Log.d(TAG, "Ignoring callback request from old prebuilt"); return; } Loading Loading @@ -629,10 +631,22 @@ public class PackageInstaller { mSession = session; } /** {@hide} */ @Deprecated public void setProgress(float progress) { setStagingProgress(progress); } /** * Set current progress. Valid values are anywhere between 0 and 1. * Set current progress of staging this session. Valid values are * anywhere between 0 and 1. * <p> * Note that this progress may not directly correspond to the value * reported by {@link SessionCallback#onProgressChanged(int, float)}, as * the system may carve out a portion of the overall progress to * represent its own internal installation work. */ public void setProgress(float progress) { public void setStagingProgress(float progress) { try { mSession.setClientProgress(progress); } catch (RemoteException e) { Loading Loading @@ -986,7 +1000,7 @@ public class PackageInstaller { /** {@hide} */ public boolean sealed; /** {@hide} */ public boolean open; public boolean active; /** {@hide} */ public int mode; Loading @@ -1010,7 +1024,7 @@ public class PackageInstaller { resolvedBaseCodePath = source.readString(); progress = source.readFloat(); sealed = source.readInt() != 0; open = source.readInt() != 0; active = source.readInt() != 0; mode = source.readInt(); sizeBytes = source.readLong(); Loading @@ -1036,20 +1050,37 @@ public class PackageInstaller { /** * Return current overall progress of this session, between 0 and 1. * <p> * Note that this progress may not directly correspond to the value reported * by {@link PackageInstaller.Session#setProgress(float)}, as the system may * carve out a portion of the overall progress to represent its own internal * installation work. * Note that this progress may not directly correspond to the value * reported by * {@link PackageInstaller.Session#setStagingProgress(float)}, as the * system may carve out a portion of the overall progress to represent * its own internal installation work. */ public float getProgress() { return progress; } /** * Return if this session is currently open. * Return if this session is currently active. * <p> * A session is considered active whenever there is ongoing forward * progress being made, such as the installer holding an open * {@link Session} instance while streaming data into place, or the * system optimizing code as the result of * {@link Session#commit(IntentSender)}. * <p> * If the installer closes the {@link Session} without committing, the * session is considered inactive until the installer opens the session * again. */ public boolean isActive() { return active; } /** {@hide} */ @Deprecated public boolean isOpen() { return open; return isActive(); } /** Loading Loading @@ -1105,7 +1136,7 @@ public class PackageInstaller { dest.writeString(resolvedBaseCodePath); dest.writeFloat(progress); dest.writeInt(sealed ? 1 : 0); dest.writeInt(open ? 1 : 0); dest.writeInt(active ? 1 : 0); dest.writeInt(mode); dest.writeLong(sizeBytes); Loading
services/core/java/com/android/server/pm/PackageInstallerService.java +8 −20 Original line number Diff line number Diff line Loading @@ -897,10 +897,9 @@ public class PackageInstallerService extends IPackageInstaller.Stub { private static class Callbacks extends Handler { private static final int MSG_SESSION_CREATED = 1; private static final int MSG_SESSION_BADGING_CHANGED = 2; private static final int MSG_SESSION_OPENED = 3; private static final int MSG_SESSION_ACTIVE_CHANGED = 3; private static final int MSG_SESSION_PROGRESS_CHANGED = 4; private static final int MSG_SESSION_CLOSED = 5; private static final int MSG_SESSION_FINISHED = 6; private static final int MSG_SESSION_FINISHED = 5; private final RemoteCallbackList<IPackageInstallerCallback> mCallbacks = new RemoteCallbackList<>(); Loading Loading @@ -945,15 +944,12 @@ public class PackageInstallerService extends IPackageInstaller.Stub { case MSG_SESSION_BADGING_CHANGED: callback.onSessionBadgingChanged(sessionId); break; case MSG_SESSION_OPENED: callback.onSessionOpened(sessionId); case MSG_SESSION_ACTIVE_CHANGED: callback.onSessionActiveChanged(sessionId, (boolean) msg.obj); break; case MSG_SESSION_PROGRESS_CHANGED: callback.onSessionProgressChanged(sessionId, (float) msg.obj); break; case MSG_SESSION_CLOSED: callback.onSessionClosed(sessionId); break; case MSG_SESSION_FINISHED: callback.onSessionFinished(sessionId, (boolean) msg.obj); break; Loading @@ -968,18 +964,14 @@ public class PackageInstallerService extends IPackageInstaller.Stub { obtainMessage(MSG_SESSION_BADGING_CHANGED, sessionId, userId).sendToTarget(); } private void notifySessionOpened(int sessionId, int userId) { obtainMessage(MSG_SESSION_OPENED, sessionId, userId).sendToTarget(); private void notifySessionActiveChanged(int sessionId, int userId, boolean active) { obtainMessage(MSG_SESSION_ACTIVE_CHANGED, sessionId, userId, active).sendToTarget(); } private void notifySessionProgressChanged(int sessionId, int userId, float progress) { obtainMessage(MSG_SESSION_PROGRESS_CHANGED, sessionId, userId, progress).sendToTarget(); } private void notifySessionClosed(int sessionId, int userId) { obtainMessage(MSG_SESSION_CLOSED, sessionId, userId).sendToTarget(); } public void notifySessionFinished(int sessionId, int userId, boolean success) { obtainMessage(MSG_SESSION_FINISHED, sessionId, userId, success).sendToTarget(); } Loading Loading @@ -1022,18 +1014,14 @@ public class PackageInstallerService extends IPackageInstaller.Stub { writeSessionsAsync(); } public void onSessionOpened(PackageInstallerSession session) { mCallbacks.notifySessionOpened(session.sessionId, session.userId); public void onSessionActiveChanged(PackageInstallerSession session, boolean active) { mCallbacks.notifySessionActiveChanged(session.sessionId, session.userId, active); } public void onSessionProgressChanged(PackageInstallerSession session, float progress) { mCallbacks.notifySessionProgressChanged(session.sessionId, session.userId, progress); } public void onSessionClosed(PackageInstallerSession session) { mCallbacks.notifySessionClosed(session.sessionId, session.userId); } public void onSessionFinished(PackageInstallerSession session, boolean success) { mCallbacks.notifySessionFinished(session.sessionId, session.userId, success); synchronized (mSessions) { Loading
services/core/java/com/android/server/pm/PackageInstallerSession.java +3 −3 Original line number Diff line number Diff line Loading @@ -227,7 +227,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { mResolvedBaseFile.getAbsolutePath() : null; info.progress = mProgress; info.sealed = mSealed; info.open = mOpenCount.get() > 0; info.active = mOpenCount.get() > 0; info.mode = params.mode; info.sizeBytes = params.sizeBytes; Loading Loading @@ -833,14 +833,14 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { public void open() { if (mOpenCount.getAndIncrement() == 0) { mCallback.onSessionOpened(this); mCallback.onSessionActiveChanged(this, true); } } @Override public void close() { if (mOpenCount.decrementAndGet() == 0) { mCallback.onSessionClosed(this); mCallback.onSessionActiveChanged(this, false); } } Loading