Merge "Fix incorrect javadoc for Uri.getQueryParameter." into mnc-dev
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 3146f41..f36d448 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4013,9 +4013,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 -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 90437b9..625f003 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -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" />
diff --git a/services/core/java/com/android/server/net/NetworkStatsService.java b/services/core/java/com/android/server/net/NetworkStatsService.java
index 50e03a2..0035d01 100644
--- a/services/core/java/com/android/server/net/NetworkStatsService.java
+++ b/services/core/java/com/android/server/net/NetworkStatsService.java
@@ -561,9 +561,10 @@
             final int callingUid = Binder.getCallingUid();
             final DevicePolicyManagerInternal dpmi = LocalServices.getService(
                     DevicePolicyManagerInternal.class);
-            if (dpmi.isActiveAdminWithPolicy(callingUid, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER)
-                    || dpmi.isActiveAdminWithPolicy(callingUid,
-                            DeviceAdminInfo.USES_POLICY_DEVICE_OWNER)) {
+
+            // Device owners are also profile owners so it is enough to check for that.
+            if (dpmi != null && dpmi.isActiveAdminWithPolicy(callingUid,
+                    DeviceAdminInfo.USES_POLICY_PROFILE_OWNER)) {
                 return;
             }
         }
diff --git a/services/core/java/com/android/server/pm/PackageInstallerService.java b/services/core/java/com/android/server/pm/PackageInstallerService.java
index a406175..09096ff 100644
--- a/services/core/java/com/android/server/pm/PackageInstallerService.java
+++ b/services/core/java/com/android/server/pm/PackageInstallerService.java
@@ -969,8 +969,11 @@
         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 @@
                 }
             }
             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 @@
                         R.color.system_notification_accent_color))
                 .setContentTitle(packageLabel)
                 .setContentText(contentText)
+                .setStyle(new Notification.BigTextStyle().bigText(contentText))
                 .setLargeIcon(packageIcon)
                 .build();
     }
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index ac3f53f..11ab042 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -1602,6 +1602,12 @@
                         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;
     }