sys user split: fix usb debugging notice

BUG:19913735
Change-Id: Iefdf8a12f1622650bb0d61e7ffb73040e4b8d498
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index fcf7e3e..e40e5da 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -163,7 +163,7 @@
     <string name="usb_debugging_secondary_user_title">USB debugging not allowed</string>
 
     <!-- Message of notification shown when trying to enable USB debugging but a secondary user is the current foreground user. -->
-    <string name="usb_debugging_secondary_user_message">The user currently signed in to this device can\'t turn on USB debugging. To use this feature, switch to the primary user \u201C<xliff:g id="name" example="John Doe">%s</xliff:g>\u201D.</string>
+    <string name="usb_debugging_secondary_user_message">The user currently signed in to this device can\'t turn on USB debugging. To use this feature, please switch to an Admin user.</string>
 
     <!-- Checkbox label for application compatibility mode ON (zooming app to look like it's running
          on a phone).  [CHAR LIMIT=25] -->
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingSecondaryUserActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingSecondaryUserActivity.java
index 9ce771b..0979ffd 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingSecondaryUserActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingSecondaryUserActivity.java
@@ -47,8 +47,7 @@
 
         final AlertController.AlertParams ap = mAlertParams;
         ap.mTitle = getString(R.string.usb_debugging_secondary_user_title);
-        UserInfo user = UserManager.get(this).getUserInfo(UserHandle.USER_OWNER);
-        ap.mMessage = getString(R.string.usb_debugging_secondary_user_message, user.name);
+        ap.mMessage = getString(R.string.usb_debugging_secondary_user_message);
         ap.mPositiveButtonText = getString(android.R.string.ok);
         ap.mPositiveButtonListener = this;
 
diff --git a/services/usb/java/com/android/server/usb/UsbDebuggingManager.java b/services/usb/java/com/android/server/usb/UsbDebuggingManager.java
index 9a04e8b..7029c39 100644
--- a/services/usb/java/com/android/server/usb/UsbDebuggingManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDebuggingManager.java
@@ -22,6 +22,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
+import android.content.pm.UserInfo;
 import android.content.res.Resources;
 import android.net.LocalSocket;
 import android.net.LocalSocketAddress;
@@ -322,21 +323,21 @@
 
     private void startConfirmation(String key, String fingerprints) {
         int currentUserId = ActivityManager.getCurrentUser();
-        UserHandle userHandle =
-                UserManager.get(mContext).getUserInfo(currentUserId).getUserHandle();
+        UserInfo userInfo = UserManager.get(mContext).getUserInfo(currentUserId);
         String componentString;
-        if (currentUserId == UserHandle.USER_OWNER) {
+        if (userInfo.isAdmin()) {
             componentString = Resources.getSystem().getString(
                     com.android.internal.R.string.config_customAdbPublicKeyConfirmationComponent);
         } else {
-            // If the current foreground user is not the primary user we send a different
+            // If the current foreground user is not the admin user we send a different
             // notification specific to secondary users.
             componentString = Resources.getSystem().getString(
                     R.string.config_customAdbPublicKeyConfirmationSecondaryUserComponent);
         }
         ComponentName componentName = ComponentName.unflattenFromString(componentString);
-        if (startConfirmationActivity(componentName, userHandle, key, fingerprints)
-                || startConfirmationService(componentName, userHandle, key, fingerprints)) {
+        if (startConfirmationActivity(componentName, userInfo.getUserHandle(), key, fingerprints)
+                || startConfirmationService(componentName, userInfo.getUserHandle(),
+                        key, fingerprints)) {
             return;
         }
         Slog.e(TAG, "unable to start customAdbPublicKeyConfirmation[SecondaryUser]Component "