diff options
| author | 2023-01-10 18:09:46 +0100 | |
|---|---|---|
| committer | 2023-01-23 17:24:13 +0100 | |
| commit | d14ca0b5b4bdd1aef34dd3a51efe75ed4a0c19ab (patch) | |
| tree | 2fc95f964c038b3d7d93f9362c1a84076f48fa1a | |
| parent | 7fa9ea28346ea71767d3bfbb85635c4b7f86fbcb (diff) | |
Implement notifySystemPropertiesChanged
This is a Test API that notifies of updates to the system properties
when requested, received by callers of
SystemProperties#addChangeCallback
Test: atest android.view.inputmethod.cts.InputMethodStatsTest; check
logs for ImeTracker onProgress entries during text execution only
Change-Id: I8b81194524de822eab7538aab68675a677b5fd6d
| -rw-r--r-- | core/api/test-current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/app/ActivityManager.java | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 8dc7dc34adaf..21d3f1601c18 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -131,6 +131,7 @@ package android.app { method @RequiresPermission(allOf={android.Manifest.permission.PACKAGE_USAGE_STATS, android.Manifest.permission.INTERACT_ACROSS_USERS_FULL}, conditional=true) public int getUidProcessState(int); method public void holdLock(android.os.IBinder, int); method public static boolean isHighEndGfx(); + method public void notifySystemPropertiesChanged(); method @RequiresPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER) public void removeHomeVisibilityListener(@NonNull android.app.HomeVisibilityListener); method @RequiresPermission(android.Manifest.permission.RESET_APP_ERRORS) public void resetAppErrors(); method public static void resumeAppSwitches() throws android.os.RemoteException; diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index b6264939c91c..487c2ccbf8e8 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -5367,6 +5367,31 @@ public class ActivityManager { } /** + * Notifies {@link #getRunningAppProcesses app processes} that the system properties + * have changed. + * + * @see SystemProperties#addChangeCallback + * + * @hide + */ + @TestApi + public void notifySystemPropertiesChanged() { + // Note: this cannot use {@link ServiceManager#listServices()} to notify all the services, + // as that is not available from tests. + final var binder = ActivityManager.getService().asBinder(); + if (binder != null) { + var data = Parcel.obtain(); + try { + binder.transact(IBinder.SYSPROPS_TRANSACTION, data, null /* reply */, + 0 /* flags */); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + data.recycle(); + } + } + + /** * A subset of immutable pending intent information suitable for caching on the client side. * * @hide |