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

Commit 2e3e943c authored by Benjamin Franz's avatar Benjamin Franz
Browse files

Add package name extra to PackageInstaller callback

If an app invokes app install via PackageInstaller APIs without knowing
the package name, the callback contains no information about the name
of the installed package. Add EXTRA_PACKAGE_NAME to this callback.

Also allow PackageInstaller to distinguish between a newly installed and
an updated package.

Bug: 19764848
Bug: 20150135
Change-Id: I062440a08df9a723e9445ea10bc6f6800c5b99a8
parent 340b198c
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -3993,9 +3993,11 @@
    <!-- Lock-to-app unlock password string -->
    <string name="lock_to_app_unlock_password">Ask for password before unpinning</string>

    <!-- Notification shown when device owner silently installs a package -->
    <!-- Notification shown when device owner silently installs a package [CHAR LIMIT=NONE] -->
    <string name="package_installed_device_owner">Installed by your administrator</string>
    <!-- Notification shown when device owner silently deletes a package -->
    <!-- Notification shown when device owner silently updates a package [CHAR LIMIT=NONE] -->
    <string name="package_updated_device_owner">Updated by your administrator</string>
    <!-- Notification shown when device owner silently deletes a package [CHAR LIMIT=NONE] -->
    <string name="package_deleted_device_owner">Deleted by your administrator</string>

    <!-- [CHAR_LIMIT=NONE] Battery saver: Feature description -->
+1 −0
Original line number Diff line number Diff line
@@ -698,6 +698,7 @@
  <java-symbol type="string" name="lock_to_app_unlock_pattern" />
  <java-symbol type="string" name="lock_to_app_unlock_password" />
  <java-symbol type="string" name="package_installed_device_owner" />
  <java-symbol type="string" name="package_updated_device_owner" />
  <java-symbol type="string" name="package_deleted_device_owner" />
  <java-symbol type="string" name="lockscreen_access_pattern_cell_added" />
  <java-symbol type="string" name="lockscreen_access_pattern_cleared" />
+6 −1
Original line number Diff line number Diff line
@@ -969,8 +969,11 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
        public void onPackageInstalled(String basePackageName, int returnCode, String msg,
                Bundle extras) {
            if (PackageManager.INSTALL_SUCCEEDED == returnCode && mShowNotification) {
                boolean update = (extras != null) && extras.getBoolean(Intent.EXTRA_REPLACING);
                Notification notification = buildSuccessNotification(mContext,
                        mContext.getResources().getString(R.string.package_installed_device_owner),
                        mContext.getResources()
                                .getString(update ? R.string.package_updated_device_owner :
                                        R.string.package_installed_device_owner),
                        basePackageName,
                        mUserId);
                if (notification != null) {
@@ -980,6 +983,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
                }
            }
            final Intent fillIn = new Intent();
            fillIn.putExtra(PackageInstaller.EXTRA_PACKAGE_NAME, basePackageName);
            fillIn.putExtra(PackageInstaller.EXTRA_SESSION_ID, mSessionId);
            fillIn.putExtra(PackageInstaller.EXTRA_STATUS,
                    PackageManager.installStatusToPublicStatus(returnCode));
@@ -1030,6 +1034,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
                        R.color.system_notification_accent_color))
                .setContentTitle(packageLabel)
                .setContentText(contentText)
                .setStyle(new Notification.BigTextStyle().bigText(contentText))
                .setLargeIcon(packageIcon)
                .build();
    }
+6 −0
Original line number Diff line number Diff line
@@ -1596,6 +1596,12 @@ public class PackageManagerService extends IPackageManager.Stub {
                        res.origPackage);
                break;
            }
            case PackageManager.INSTALL_SUCCEEDED: {
                extras = new Bundle();
                extras.putBoolean(Intent.EXTRA_REPLACING,
                        res.removedInfo != null && res.removedInfo.removedPackage != null);
                break;
            }
        }
        return extras;
    }