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

Commit 05d58afd authored by Xiaohui Chen's avatar Xiaohui Chen
Browse files

sys user split: fix usb debugging notice

BUG:19913735
Change-Id: Iefdf8a12f1622650bb0d61e7ffb73040e4b8d498
parent 06f8ebb7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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] -->
+1 −2
Original line number Diff line number Diff line
@@ -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;

+7 −6
Original line number Diff line number Diff line
@@ -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 "