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

Commit d14ca0b5 authored by Cosmin Băieș's avatar Cosmin Băieș
Browse files

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
parent 7fa9ea28
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
+25 −0
Original line number Diff line number Diff line
@@ -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.
     *