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

Commit 110e2e87 authored by Christopher Tate's avatar Christopher Tate Committed by android-build-merger
Browse files

Merge "Move the \'pretend idle jobs can run now\' broadcast into AMS" into nyc-dev

am: 05889540

* commit '05889540':
  Move the 'pretend idle jobs can run now' broadcast into AMS

Change-Id: Ia97d382761fc8b9f2c11729cd027a2d8c6c9379b
parents 559233a0 05889540
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1598,10 +1598,10 @@ public class Am extends BaseCommand {
        }

        System.out.println("Performing idle maintenance...");
        Intent intent = new Intent(
                "com.android.server.task.controllers.IdleController.ACTION_TRIGGER_IDLE");
        mAm.broadcastIntent(null, intent, null, null, 0, null, null, null,
                android.app.AppOpsManager.OP_NONE, null, true, false, UserHandle.USER_ALL);
        try {
            mAm.sendIdleJobTrigger();
        } catch (RemoteException e) {
        }
    }

    private void runScreenCompat() throws Exception {
+16 −0
Original line number Diff line number Diff line
@@ -2970,6 +2970,12 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            reply.writeNoException();
            return true;
        }
        case SEND_IDLE_JOB_TRIGGER_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            sendIdleJobTrigger();
            reply.writeNoException();
            return true;
        }
        }

        return super.onTransact(code, data, reply, flags);
@@ -6247,6 +6253,16 @@ class ActivityManagerProxy implements IActivityManager
        reply.recycle();
    }

    public void sendIdleJobTrigger() throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        mRemote.transact(SEND_IDLE_JOB_TRIGGER_TRANSACTION, data, reply, 0);
        reply.readException();
        data.recycle();
        reply.recycle();
    }

    public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
            IActivityContainerCallback callback) throws RemoteException {
        Parcel data = Parcel.obtain();
+3 −0
Original line number Diff line number Diff line
@@ -546,6 +546,8 @@ public interface IActivityManager extends IInterface {

    public void performIdleMaintenance() throws RemoteException;

    public void sendIdleJobTrigger() throws RemoteException;

    public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
            IActivityContainerCallback callback) throws RemoteException;

@@ -1035,4 +1037,5 @@ public interface IActivityManager extends IInterface {
    int SWAP_DOCKED_AND_FULLSCREEN_STACK = IBinder.FIRST_CALL_TRANSACTION + 372;
    int NOTIFY_LOCKED_PROFILE = IBinder.FIRST_CALL_TRANSACTION + 373;
    int START_CONFIRM_DEVICE_CREDENTIAL_INTENT = IBinder.FIRST_CALL_TRANSACTION + 374;
    int SEND_IDLE_JOB_TRIGGER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 375;
}
+1 −1
Original line number Diff line number Diff line
@@ -307,7 +307,7 @@
    <protected-broadcast android:name="android.intent.action.ACTION_IDLE_MAINTENANCE_START" />
    <protected-broadcast android:name="android.intent.action.ACTION_IDLE_MAINTENANCE_END" />

    <protected-broadcast android:name="com.android.server.task.controllers.IdleController.ACTION_TRIGGER_IDLE" />
    <protected-broadcast android:name="com.android.server.ACTION_TRIGGER_IDLE" />

    <protected-broadcast android:name="android.intent.action.HDMI_PLUGGED" />

+25 −0
Original line number Diff line number Diff line
@@ -390,6 +390,11 @@ public final class ActivityManagerService extends ActivityManagerNative
    private static final String TAG_VISIBILITY = TAG + POSTFIX_VISIBILITY;
    private static final String TAG_VISIBLE_BEHIND = TAG + POSTFIX_VISIBLE_BEHIND;
    // Mock "pretend we're idle now" broadcast action to the job scheduler; declared
    // here so that while the job scheduler can depend on AMS, the other way around
    // need not be the case.
    public static final String ACTION_TRIGGER_IDLE = "com.android.server.ACTION_TRIGGER_IDLE";
    /** Control over CPU and battery monitoring */
    // write battery stats every 30 minutes.
    static final long BATTERY_STATS_TIME = 30 * 60 * 1000;
@@ -12658,6 +12663,26 @@ public final class ActivityManagerService extends ActivityManagerNative
        }
    }
    @Override
    public void sendIdleJobTrigger() {
        if (checkCallingPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER)
                != PackageManager.PERMISSION_GRANTED) {
            throw new SecurityException("Requires permission "
                    + android.Manifest.permission.SET_ACTIVITY_WATCHER);
        }
        final long ident = Binder.clearCallingIdentity();
        try {
            Intent intent = new Intent(ACTION_TRIGGER_IDLE)
                    .setPackage("android")
                    .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
            broadcastIntent(null, intent, null, null, 0, null, null, null,
                    android.app.AppOpsManager.OP_NONE, null, true, false, UserHandle.USER_ALL);
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
    }
    private void retrieveSettings() {
        final ContentResolver resolver = mContext.getContentResolver();
        final boolean freeformWindowManagement =
Loading