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

Commit c5da14c2 authored by Michael Groover's avatar Michael Groover
Browse files

Write ADB keys to adb_keys as well for backwards compat

The original design of revoking adb keys after a period of
inactivity did not properly verify that the system held the
corresponding private key. There will need to be additional
coordination between adbd and the framework after a system
passes the SIGNATURE challenge to determine if the key should
be allowed, but this change will restore the original behavior
for beta 1.

Bug: 124076524
Test: Manually verified key is written to adb_keys and subsequent
      connections went through the SIGNATURE challenge

Change-Id: Ib735f8a4d83518d4f6b5e939dcd1a2f5ae6f4837
parent 699905e5
Loading
Loading
Loading
Loading
+6 −14
Original line number Diff line number Diff line
@@ -322,6 +322,9 @@ public class AdbDebuggingManager {
                            mConnectedKey = key;
                            mAdbKeyStore.setLastConnectionTime(key, System.currentTimeMillis());
                            scheduleJobToUpdateAdbKeyStore();
                            // write this key to adb_keys as well so that subsequent connections can
                            // go through the expected SIGNATURE interaction.
                            writeKey(key);
                        }
                        logAdbConnectionChanged(key, AdbProtoEnums.USER_ALLOWED, alwaysAllow);
                    }
@@ -354,20 +357,9 @@ public class AdbDebuggingManager {
                        }
                        break;
                    }
                    // Check if the key should be allowed without user interaction.
                    if (mAdbKeyStore.isKeyAuthorized(key)) {
                        if (mThread != null) {
                            mThread.sendResponse("OK");
                            mAdbKeyStore.setLastConnectionTime(key, System.currentTimeMillis());
                            logAdbConnectionChanged(key, AdbProtoEnums.AUTOMATICALLY_ALLOWED, true);
                            mConnectedKey = key;
                            scheduleJobToUpdateAdbKeyStore();
                        }
                    } else {
                    logAdbConnectionChanged(key, AdbProtoEnums.AWAITING_USER_APPROVAL, false);
                    mFingerprints = fingerprints;
                    startConfirmation(key, mFingerprints);
                    }
                    break;
                }