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

Commit f10d0399 authored by Aaron Whyte's avatar Aaron Whyte
Browse files

Made secure-adb's new-public-key activity configurable.

Some devices do not have lockscreens themselves, so the plan is to have them
do RPCs to companion devices that can have lockscreens, for allowing or
rejecting unwhitelisted adb public keys.

Change-Id: I6f7504313074e6748c0bd467a29ac3a311036f4d
parent 5579ec33
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1331,6 +1331,12 @@
         Example: com.google.android.myapp/.resolver.MyResolverActivity  -->
    <string name="config_customResolverActivity"></string>

    <!-- Name of the activity that prompts the user to reject, accept, or whitelist
         an adb host's public key, when an unwhitelisted host connects to the local adbd.
         Can be customized for other product types -->
    <string name="config_customAdbPublicKeyActivity"
            >com.android.systemui/com.android.systemui.usb.UsbDebuggingActivity</string>

    <!-- Apps that are authorized to access shared accounts, overridden by product overlays -->
    <string name="config_appsAuthorizedForSharedAccounts">;com.android.settings;</string>

@@ -1413,4 +1419,5 @@
         1 - The device DOES have a permanent menu key; ignore autodetection.
         2 - The device DOES NOT have a permanent menu key; ignore autodetection. -->
    <integer name="config_overrideHasPermanentMenuKey">0</integer>

</resources>
+1 −0
Original line number Diff line number Diff line
@@ -1625,6 +1625,7 @@
  <java-symbol type="string" name="enable_explore_by_touch_warning_message" />
  <java-symbol type="bool" name="config_powerDecoupleAutoSuspendModeFromDisplay" />
  <java-symbol type="bool" name="config_powerDecoupleInteractiveModeFromDisplay" />
  <java-symbol type="string" name="config_customAdbPublicKeyActivity" />

  <java-symbol type="layout" name="resolver_list" />
  <java-symbol type="id" name="resolver_list" />
+13 −8
Original line number Diff line number Diff line
@@ -17,8 +17,10 @@
package com.android.server.usb;

import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.LocalSocket;
import android.net.LocalSocketAddress;
import android.os.Handler;
@@ -244,15 +246,18 @@ public class UsbDebuggingManager implements Runnable {
    }

    private void showConfirmationDialog(String key, String fingerprints) {
        Intent dialogIntent = new Intent();

        dialogIntent.setClassName("com.android.systemui",
                "com.android.systemui.usb.UsbDebuggingActivity");
        dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        dialogIntent.putExtra("key", key);
        dialogIntent.putExtra("fingerprints", fingerprints);
        Intent intent = new Intent();

        ComponentName componentName = ComponentName.unflattenFromString(
                Resources.getSystem().getString(
                        com.android.internal.R.string.config_customAdbPublicKeyActivity));
        intent.setClassName(componentName.getPackageName(),
                componentName.getClassName());
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.putExtra("key", key);
        intent.putExtra("fingerprints", fingerprints);
        try {
            mContext.startActivity(dialogIntent);
            mContext.startActivity(intent);
        } catch (ActivityNotFoundException e) {
            Slog.e(TAG, "unable to start UsbDebuggingActivity");
        }