Skip to content
Commit 31100f10 authored by William Hester's avatar William Hester Committed by Cherrypicker Worker
Browse files

Fix ADB key file reading

The "adb_temp_keys.xml" file is used to keep track of each ADB key and
when it was previously connected. It also keeps track of authorized WiFi
networks. It is written correctly, however, the parser currently is
unable to read the file that it wrote, meaning that:
1. ADB keys never properly expire
2. WiFi APs are never properly restored

Furthermore, because of complex interactions with restoring the adb_keys
file in Test Harness Mode, duplicate keys get appended repteatedly to
the adb_keys file if they're not in the key map.

This cleans up the file, making it more testable, adds tests for the
previously broken functionality, and just performs some simple
restructuring of bits of the code that were error-prone.

Now, the adb_keys file is nothing but a view of the temp keys file. When
keys are added to the temp keys file, we completely rewrite the adb_keys
file with the set of keys present in the temp keys file, meaning that
duplicates cannot be added.

This also introduces a method for other system services (primarily for
TestHarnessModeService) to notify the AdbDebuggingManager that the key
files were modified, and it should reload the state.

Bug: 236299256
Test: atest AdbDebuggingManagerTest

Change-Id: Iae955aca17e873288d58b16f184bd4d325d50d86
(cherry picked from commit efb8194e)
Merged-In: Iae955aca17e873288d58b16f184bd4d325d50d86
parent 9f268ea1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment