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

Commit e371b09f authored by Kweku Adams's avatar Kweku Adams
Browse files

Create empty PowerWhitelistManager.

This is the first step in extracting the power whitelist from
DeviceIdleController. The whitelist will stay inside the JobScheduler
mainline module boundary, so all calls will have to be made through a
stable API. Eventually, all users of IDeviceIdleController will be
migrated to this interface.

Bug: 140141678
Bug: 141155196
Bug: 144864180
Test: atest PowerWhitelistTest
Change-Id: I8468e74ac8fe6611bfa957d4f5093c8d15be1299
parent 4771ed48
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.app.SystemServiceRegistry;
import android.content.Context;
import android.os.DeviceIdleManager;
import android.os.IDeviceIdleController;
import android.os.PowerWhitelistManager;

/**
 * Class holding initialization code for the job scheduler module.
@@ -48,5 +49,8 @@ public class JobSchedulerFrameworkInitializer {
                Context.DEVICE_IDLE_CONTROLLER, DeviceIdleManager.class,
                (context, b) -> new DeviceIdleManager(
                        context, IDeviceIdleController.Stub.asInterface(b)));
        SystemServiceRegistry.registerContextAwareService(
                Context.POWER_WHITELIST_MANAGER, PowerWhitelistManager.class,
                PowerWhitelistManager::new);
    }
}
+42 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.os;

import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.content.Context;

/**
 * Interface to access and modify the power save whitelist.
 *
 * @hide
 */
@SystemApi
@TestApi
@SystemService(Context.POWER_WHITELIST_MANAGER)
public class PowerWhitelistManager {
    private final Context mContext;

    /**
     * @hide
     */
    public PowerWhitelistManager(@NonNull Context context) {
        mContext = context;
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -5626,6 +5626,9 @@ package android.os {
    field public static final int USER_ACTIVITY_FLAG_NO_CHANGE_LIGHTS = 1; // 0x1
  }
  public class PowerWhitelistManager {
  }
  public class RecoverySystem {
    method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void cancelScheduledUpdate(android.content.Context) throws java.io.IOException;
    method @RequiresPermission(android.Manifest.permission.RECOVERY) public static void installPackage(android.content.Context, java.io.File, boolean) throws java.io.IOException;
+4 −0
Original line number Diff line number Diff line
@@ -706,6 +706,7 @@ package android.content {
    field public static final String CONTENT_CAPTURE_MANAGER_SERVICE = "content_capture";
    field public static final String DEVICE_IDLE_CONTROLLER = "deviceidle";
    field public static final String PERMISSION_SERVICE = "permission";
    field public static final String POWER_WHITELIST_MANAGER = "power_whitelist";
    field public static final String ROLLBACK_SERVICE = "rollback";
    field public static final String STATUS_BAR_SERVICE = "statusbar";
    field public static final String TEST_NETWORK_SERVICE = "test_network";
@@ -2025,6 +2026,9 @@ package android.os {
    field public static final int POWER_SAVE_MODE_TRIGGER_PERCENTAGE = 0; // 0x0
  }

  public class PowerWhitelistManager {
  }

  public class Process {
    method public static final int getThreadScheduler(int) throws java.lang.IllegalArgumentException;
    field public static final int FIRST_APP_ZYGOTE_ISOLATED_UID = 90000; // 0x15f90
+10 −0
Original line number Diff line number Diff line
@@ -3308,6 +3308,7 @@ public abstract class Context {
            ROLLBACK_SERVICE,
            DROPBOX_SERVICE,
            //@hide: DEVICE_IDLE_CONTROLLER,
            //@hide: POWER_WHITELIST_MANAGER,
            DEVICE_POLICY_SERVICE,
            UI_MODE_SERVICE,
            DOWNLOAD_SERVICE,
@@ -4292,6 +4293,15 @@ public abstract class Context {
    @TestApi
    public static final String DEVICE_IDLE_CONTROLLER = "deviceidle";

    /**
     * System service name for the PowerWhitelistManager.
     *
     * @see #getSystemService(String)
     * @hide
     */
    @TestApi
    public static final String POWER_WHITELIST_MANAGER = "power_whitelist";

    /**
     * Use with {@link #getSystemService(String)} to retrieve a
     * {@link android.app.admin.DevicePolicyManager} for working with global