Merge "Expose TestAPIs needed by GtsOsTestCases" into pi-dev
am: d565f04957
Change-Id: Ifa630db3e1d20f3b96cb3d9637391590ce2652bf
This commit is contained in:
@@ -245,6 +245,8 @@ package android.content.pm {
|
||||
method public abstract int getInstallReason(java.lang.String, android.os.UserHandle);
|
||||
method public abstract java.lang.String[] getNamesForUids(int[]);
|
||||
method public abstract java.lang.String getPermissionControllerPackageName();
|
||||
method public abstract java.lang.String getServicesSystemSharedLibraryPackageName();
|
||||
method public abstract java.lang.String getSharedSystemSharedLibraryPackageName();
|
||||
method public abstract boolean isPermissionReviewModeEnabled();
|
||||
field public static final java.lang.String FEATURE_ADOPTABLE_STORAGE = "android.software.adoptable_storage";
|
||||
field public static final java.lang.String FEATURE_FILE_BASED_ENCRYPTION = "android.software.file_based_encryption";
|
||||
@@ -465,6 +467,10 @@ package android.location {
|
||||
method public void setType(int);
|
||||
}
|
||||
|
||||
public class LocationManager {
|
||||
method public java.lang.String[] getBackgroundThrottlingWhitelist();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.media {
|
||||
@@ -544,6 +550,15 @@ package android.os {
|
||||
field public static final int RESOURCES_SDK_INT;
|
||||
}
|
||||
|
||||
public class DeviceIdleManager {
|
||||
method public java.lang.String[] getSystemPowerWhitelist();
|
||||
method public java.lang.String[] getSystemPowerWhitelistExceptIdle();
|
||||
}
|
||||
|
||||
public class Environment {
|
||||
method public static java.io.File buildPath(java.io.File, java.lang.String...);
|
||||
}
|
||||
|
||||
public class IncidentManager {
|
||||
method public void reportIncident(android.os.IncidentReportArgs);
|
||||
}
|
||||
@@ -611,12 +626,18 @@ package android.os {
|
||||
method public abstract void log(android.os.StrictMode.ViolationInfo);
|
||||
}
|
||||
|
||||
public class SystemProperties {
|
||||
method public static java.lang.String get(java.lang.String, java.lang.String);
|
||||
}
|
||||
|
||||
public final class UserHandle implements android.os.Parcelable {
|
||||
method public static int getAppId(int);
|
||||
method public int getIdentifier();
|
||||
field public static final android.os.UserHandle SYSTEM;
|
||||
}
|
||||
|
||||
public class UserManager {
|
||||
method public static boolean isSplitSystemUser();
|
||||
field public static final java.lang.String ACTION_USER_RESTRICTIONS_CHANGED = "android.os.action.USER_RESTRICTIONS_CHANGED";
|
||||
}
|
||||
|
||||
|
||||
@@ -1512,7 +1512,6 @@ Landroid/os/UserHandle;-><init>(I)V
|
||||
Landroid/os/UserHandle;->MU_ENABLED:Z
|
||||
Landroid/os/UserHandle;->OWNER:Landroid/os/UserHandle;
|
||||
Landroid/os/UserHandle;->PER_USER_RANGE:I
|
||||
Landroid/os/UserHandle;->SYSTEM:Landroid/os/UserHandle;
|
||||
Landroid/os/UserHandle;->USER_ALL:I
|
||||
Landroid/os/UserHandle;->USER_CURRENT:I
|
||||
Landroid/os/UserHandle;->USER_CURRENT_OR_SELF:I
|
||||
|
||||
@@ -105,10 +105,12 @@ import android.nfc.NfcManager;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.BatteryStats;
|
||||
import android.os.Build;
|
||||
import android.os.DeviceIdleManager;
|
||||
import android.os.DropBoxManager;
|
||||
import android.os.HardwarePropertiesManager;
|
||||
import android.os.IBatteryPropertiesRegistrar;
|
||||
import android.os.IBinder;
|
||||
import android.os.IDeviceIdleController;
|
||||
import android.os.IHardwarePropertiesManager;
|
||||
import android.os.IPowerManager;
|
||||
import android.os.IRecoverySystem;
|
||||
@@ -984,6 +986,17 @@ final class SystemServiceRegistry {
|
||||
ctx.mMainThread.getHandler());
|
||||
}
|
||||
});
|
||||
|
||||
registerService(Context.DEVICE_IDLE_CONTROLLER, DeviceIdleManager.class,
|
||||
new CachedServiceFetcher<DeviceIdleManager>() {
|
||||
@Override
|
||||
public DeviceIdleManager createService(ContextImpl ctx)
|
||||
throws ServiceNotFoundException {
|
||||
IDeviceIdleController service = IDeviceIdleController.Stub.asInterface(
|
||||
ServiceManager.getServiceOrThrow(
|
||||
Context.DEVICE_IDLE_CONTROLLER));
|
||||
return new DeviceIdleManager(ctx.getOuterContext(), service);
|
||||
}});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3780,7 +3780,7 @@ public abstract class Context {
|
||||
public static final String DROPBOX_SERVICE = "dropbox";
|
||||
|
||||
/**
|
||||
* System service name for the DeviceIdleController. There is no Java API for this.
|
||||
* System service name for the DeviceIdleManager.
|
||||
* @see #getSystemService(String)
|
||||
* @hide
|
||||
*/
|
||||
|
||||
@@ -3952,6 +3952,7 @@ public abstract class PackageManager {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
public abstract @NonNull String getServicesSystemSharedLibraryPackageName();
|
||||
|
||||
/**
|
||||
@@ -3961,6 +3962,7 @@ public abstract class PackageManager {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
public abstract @NonNull String getSharedSystemSharedLibraryPackageName();
|
||||
|
||||
/**
|
||||
|
||||
69
core/java/android/os/DeviceIdleManager.java
Normal file
69
core/java/android/os/DeviceIdleManager.java
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.SystemService;
|
||||
import android.annotation.TestApi;
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* Access to the service that keeps track of device idleness and drives low power mode based on
|
||||
* that.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
@SystemService(Context.DEVICE_IDLE_CONTROLLER)
|
||||
public class DeviceIdleManager {
|
||||
private final Context mContext;
|
||||
private final IDeviceIdleController mService;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public DeviceIdleManager(@NonNull Context context, @NonNull IDeviceIdleController service) {
|
||||
mContext = context;
|
||||
mService = service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return package names the system has white-listed to opt out of power save restrictions,
|
||||
* except for device idle mode.
|
||||
*/
|
||||
public @NonNull String[] getSystemPowerWhitelistExceptIdle() {
|
||||
try {
|
||||
return mService.getSystemPowerWhitelistExceptIdle();
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return package names the system has white-listed to opt out of power save restrictions for
|
||||
* all modes.
|
||||
*/
|
||||
public @NonNull String[] getSystemPowerWhitelist() {
|
||||
try {
|
||||
return mService.getSystemPowerWhitelist();
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.os;
|
||||
|
||||
import android.annotation.TestApi;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.Context;
|
||||
import android.os.storage.StorageManager;
|
||||
@@ -1033,6 +1034,7 @@ public class Environment {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
public static File buildPath(File base, String... segments) {
|
||||
File cur = base;
|
||||
for (String segment : segments) {
|
||||
|
||||
@@ -19,6 +19,7 @@ package android.os;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.TestApi;
|
||||
import android.util.Log;
|
||||
import android.util.MutableInt;
|
||||
|
||||
@@ -35,6 +36,7 @@ import java.util.HashMap;
|
||||
* {@hide}
|
||||
*/
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public class SystemProperties {
|
||||
private static final String TAG = "SystemProperties";
|
||||
private static final boolean TRACK_KEY_ACCESS = false;
|
||||
@@ -110,6 +112,7 @@ public class SystemProperties {
|
||||
*/
|
||||
@NonNull
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public static String get(@NonNull String key, @Nullable String def) {
|
||||
if (TRACK_KEY_ACCESS) onKeyAccess(key);
|
||||
return native_get(key, def);
|
||||
|
||||
@@ -82,6 +82,7 @@ public final class UserHandle implements Parcelable {
|
||||
public static final int USER_SERIAL_SYSTEM = 0;
|
||||
|
||||
/** @hide A user handle to indicate the "system" user of the device */
|
||||
@TestApi
|
||||
public static final UserHandle SYSTEM = new UserHandle(USER_SYSTEM);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1149,6 +1149,7 @@ public class UserManager {
|
||||
* primary user are two separate users. Previously system user and primary user are combined as
|
||||
* a single owner user. see @link {android.os.UserHandle#USER_OWNER}
|
||||
*/
|
||||
@TestApi
|
||||
public static boolean isSplitSystemUser() {
|
||||
return RoSystemProperties.FW_SYSTEM_USER_SPLIT;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import android.annotation.RequiresPermission;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.SystemService;
|
||||
import android.annotation.TestApi;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -391,6 +392,18 @@ public class LocationManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
public String[] getBackgroundThrottlingWhitelist() {
|
||||
try {
|
||||
return mService.getBackgroundThrottlingWhitelist();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide - hide this constructor because it has a parameter
|
||||
* of type ILocationManager, which is a system private class. The
|
||||
|
||||
Reference in New Issue
Block a user