From 05d58afddb1bbfa893354c1cb331bd69c9d2cb6f Mon Sep 17 00:00:00 2001 From: Xiaohui Chen Date: Mon, 13 Jul 2015 14:17:48 -0700 Subject: [PATCH] sys user split: fix usb debugging notice BUG:19913735 Change-Id: Iefdf8a12f1622650bb0d61e7ffb73040e4b8d498 --- packages/SystemUI/res/values/strings.xml | 2 +- .../usb/UsbDebuggingSecondaryUserActivity.java | 3 +-- .../com/android/server/usb/UsbDebuggingManager.java | 13 +++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index fcf7e3e90bbb1..e40e5dacfdb42 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -163,7 +163,7 @@ USB debugging not allowed - The user currently signed in to this device can\'t turn on USB debugging. To use this feature, switch to the primary user \u201C%s\u201D. + The user currently signed in to this device can\'t turn on USB debugging. To use this feature, please switch to an Admin user. diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingSecondaryUserActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingSecondaryUserActivity.java index 9ce771bd9ee43..0979ffd001522 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 @@ public class UsbDebuggingSecondaryUserActivity extends AlertActivity 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 9a04e8bb278a8..7029c396a2c73 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.ComponentName; 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 @@ public class UsbDebuggingManager { 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 "