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
This commit is contained in:
Cosmin Băieș
2023-01-10 18:09:46 +01:00
parent 7fa9ea2834
commit d14ca0b5b4
2 changed files with 26 additions and 0 deletions

View File

@@ -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;

View File

@@ -5366,6 +5366,31 @@ public class ActivityManager {
return PowerExemptionManager.REASON_DENIED;
}
/**
* 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.
*