Merge "Add new constants for dark mode screen"
diff --git a/api/system-current.txt b/api/system-current.txt
index 10d6d5d..1fad776 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -1461,6 +1461,7 @@
field @NonNull public static final android.os.Parcelable.Creator<android.content.om.OverlayInfo> CREATOR;
field public final String category;
field public final String packageName;
+ field public final String targetOverlayableName;
field public final String targetPackageName;
field public final int userId;
}
@@ -5424,14 +5425,14 @@
public final class PowerManager {
method @RequiresPermission(allOf={android.Manifest.permission.READ_DREAM_STATE, android.Manifest.permission.WRITE_DREAM_STATE}) public void dream(long);
method @RequiresPermission(android.Manifest.permission.DEVICE_POWER) public boolean forceSuspend();
- method @RequiresPermission(android.Manifest.permission.POWER_SAVER) public int getPowerSaveMode();
+ method @RequiresPermission(android.Manifest.permission.POWER_SAVER) public int getPowerSaveModeTrigger();
method @RequiresPermission(anyOf={android.Manifest.permission.DEVICE_POWER, android.Manifest.permission.POWER_SAVER}) public boolean setAdaptivePowerSaveEnabled(boolean);
method @RequiresPermission(anyOf={android.Manifest.permission.DEVICE_POWER, android.Manifest.permission.POWER_SAVER}) public boolean setAdaptivePowerSavePolicy(@NonNull android.os.BatterySaverPolicyConfig);
- method @RequiresPermission(android.Manifest.permission.POWER_SAVER) public boolean setDynamicPowerSavings(boolean, int);
+ method @RequiresPermission(android.Manifest.permission.POWER_SAVER) public boolean setDynamicPowerSaveHint(boolean, int);
method @RequiresPermission(anyOf={android.Manifest.permission.DEVICE_POWER, android.Manifest.permission.POWER_SAVER}) public boolean setPowerSaveModeEnabled(boolean);
method @RequiresPermission(anyOf={android.Manifest.permission.DEVICE_POWER, android.Manifest.permission.USER_ACTIVITY}) public void userActivity(long, int, int);
- field public static final int POWER_SAVER_MODE_DYNAMIC = 1; // 0x1
- field public static final int POWER_SAVER_MODE_PERCENTAGE = 0; // 0x0
+ field public static final int POWER_SAVE_MODE_TRIGGER_DYNAMIC = 1; // 0x1
+ field public static final int POWER_SAVE_MODE_TRIGGER_PERCENTAGE = 0; // 0x0
field public static final int USER_ACTIVITY_EVENT_ACCESSIBILITY = 3; // 0x3
field public static final int USER_ACTIVITY_EVENT_BUTTON = 1; // 0x1
field public static final int USER_ACTIVITY_EVENT_OTHER = 0; // 0x0
@@ -6434,7 +6435,7 @@
public abstract class ContentCaptureService extends android.app.Service {
ctor public ContentCaptureService();
- method public final void disableContentCaptureServices();
+ method public final void disableSelf();
method public void onActivityEvent(@NonNull android.service.contentcapture.ActivityEvent);
method public void onActivitySnapshot(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.service.contentcapture.SnapshotData);
method public void onConnected();
diff --git a/api/test-current.txt b/api/test-current.txt
index 75adf04..01b56c4 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -352,6 +352,10 @@
method public boolean isUiModeLocked();
}
+ public class WallpaperManager {
+ method @RequiresPermission("android.permission.SET_WALLPAPER_COMPONENT") public boolean setWallpaperComponent(android.content.ComponentName);
+ }
+
public class WindowConfiguration implements java.lang.Comparable<android.app.WindowConfiguration> android.os.Parcelable {
ctor public WindowConfiguration();
method public int compareTo(android.app.WindowConfiguration);
@@ -608,6 +612,7 @@
public abstract class Context {
method public android.content.Context createPackageContextAsUser(String, int, android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
method public abstract android.view.Display getDisplay();
+ method public abstract int getDisplayId();
method public android.os.UserHandle getUser();
method public int getUserId();
method public void setAutofillOptions(@Nullable android.content.AutofillOptions);
@@ -618,6 +623,7 @@
public class ContextWrapper extends android.content.Context {
method public android.view.Display getDisplay();
+ method public int getDisplayId();
}
public class Intent implements java.lang.Cloneable android.os.Parcelable {
@@ -1803,11 +1809,11 @@
}
public final class PowerManager {
- method @RequiresPermission("android.permission.POWER_SAVER") public int getPowerSaveMode();
- method @RequiresPermission("android.permission.POWER_SAVER") public boolean setDynamicPowerSavings(boolean, int);
+ method @RequiresPermission("android.permission.POWER_SAVER") public int getPowerSaveModeTrigger();
+ method @RequiresPermission("android.permission.POWER_SAVER") public boolean setDynamicPowerSaveHint(boolean, int);
method @RequiresPermission(anyOf={"android.permission.DEVICE_POWER", "android.permission.POWER_SAVER"}) public boolean setPowerSaveModeEnabled(boolean);
- field public static final int POWER_SAVER_MODE_DYNAMIC = 1; // 0x1
- field public static final int POWER_SAVER_MODE_PERCENTAGE = 0; // 0x0
+ field public static final int POWER_SAVE_MODE_TRIGGER_DYNAMIC = 1; // 0x1
+ field public static final int POWER_SAVE_MODE_TRIGGER_PERCENTAGE = 0; // 0x0
}
public class Process {
@@ -2155,7 +2161,7 @@
public static final class Settings.Global extends android.provider.Settings.NameValueTable {
field public static final String AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES = "autofill_compat_mode_allowed_packages";
- field public static final String AUTOMATIC_POWER_SAVER_MODE = "automatic_power_saver_mode";
+ field public static final String AUTOMATIC_POWER_SAVE_MODE = "automatic_power_save_mode";
field public static final String BATTERY_SAVER_CONSTANTS = "battery_saver_constants";
field public static final String CAPTIVE_PORTAL_FALLBACK_PROBE_SPECS = "captive_portal_fallback_probe_specs";
field public static final String CAPTIVE_PORTAL_FALLBACK_URL = "captive_portal_fallback_url";
@@ -2440,7 +2446,7 @@
public abstract class ContentCaptureService extends android.app.Service {
ctor public ContentCaptureService();
- method public final void disableContentCaptureServices();
+ method public final void disableSelf();
method public void onActivityEvent(@NonNull android.service.contentcapture.ActivityEvent);
method public void onActivitySnapshot(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.service.contentcapture.SnapshotData);
method public void onConnected();
diff --git a/cmds/idmap2/idmap2/Scan.cpp b/cmds/idmap2/idmap2/Scan.cpp
index 24331af..55b1003 100644
--- a/cmds/idmap2/idmap2/Scan.cpp
+++ b/cmds/idmap2/idmap2/Scan.cpp
@@ -196,13 +196,7 @@
std::stringstream stream;
for (const auto& overlay : interesting_apks) {
- std::vector<std::string> verify_args = {"--idmap-path", overlay.idmap_path};
- for (const std::string& policy : overlay.policies) {
- verify_args.emplace_back("--policy");
- verify_args.emplace_back(policy);
- }
-
- if (!Verify(std::vector<std::string>(verify_args))) {
+ if (!Verify(std::vector<std::string>({"--idmap-path", overlay.idmap_path}))) {
std::vector<std::string> create_args = {"--target-apk-path", target_apk_path,
"--overlay-apk-path", overlay.apk_path,
"--idmap-path", overlay.idmap_path};
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index a929fe0..325a54b 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -25,6 +25,7 @@
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
import android.annotation.SystemService;
+import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -1666,6 +1667,7 @@
*
* @hide
*/
+ @TestApi
@SystemApi
@RequiresPermission(android.Manifest.permission.SET_WALLPAPER_COMPONENT)
public boolean setWallpaperComponent(ComponentName name) {
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 5139064..d7a2e1b 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -5329,6 +5329,7 @@
* @return display ID associated with this {@link Context}.
* @hide
*/
+ @TestApi
public abstract int getDisplayId();
/**
diff --git a/core/java/android/content/om/OverlayInfo.java b/core/java/android/content/om/OverlayInfo.java
index 999d986..aabe59d 100644
--- a/core/java/android/content/om/OverlayInfo.java
+++ b/core/java/android/content/om/OverlayInfo.java
@@ -18,12 +18,14 @@
import android.annotation.IntDef;
import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.util.Objects;
/**
* Immutable overlay information about a package. All PackageInfos that
@@ -138,6 +140,14 @@
public final String targetPackageName;
/**
+ * Name of the target overlayable declaration.
+ *
+ * @hide
+ */
+ @SystemApi
+ public final String targetOverlayableName;
+
+ /**
* Category of the overlay package
*
* @hide
@@ -190,16 +200,19 @@
* @hide
*/
public OverlayInfo(@NonNull OverlayInfo source, @State int state) {
- this(source.packageName, source.targetPackageName, source.category, source.baseCodePath,
- state, source.userId, source.priority, source.isStatic);
+ this(source.packageName, source.targetPackageName, source.targetOverlayableName,
+ source.category, source.baseCodePath, state, source.userId, source.priority,
+ source.isStatic);
}
/** @hide */
public OverlayInfo(@NonNull String packageName, @NonNull String targetPackageName,
- @NonNull String category, @NonNull String baseCodePath, int state, int userId,
+ @Nullable String targetOverlayableName, @Nullable String category,
+ @NonNull String baseCodePath, int state, int userId,
int priority, boolean isStatic) {
this.packageName = packageName;
this.targetPackageName = targetPackageName;
+ this.targetOverlayableName = targetOverlayableName;
this.category = category;
this.baseCodePath = baseCodePath;
this.state = state;
@@ -213,6 +226,7 @@
public OverlayInfo(Parcel source) {
packageName = source.readString();
targetPackageName = source.readString();
+ targetOverlayableName = source.readString();
category = source.readString();
baseCodePath = source.readString();
state = source.readInt();
@@ -256,6 +270,7 @@
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(packageName);
dest.writeString(targetPackageName);
+ dest.writeString(targetOverlayableName);
dest.writeString(category);
dest.writeString(baseCodePath);
dest.writeInt(state);
@@ -335,6 +350,8 @@
result = prime * result + state;
result = prime * result + ((packageName == null) ? 0 : packageName.hashCode());
result = prime * result + ((targetPackageName == null) ? 0 : targetPackageName.hashCode());
+ result = prime * result + ((targetOverlayableName == null) ? 0
+ : targetOverlayableName.hashCode());
result = prime * result + ((category == null) ? 0 : category.hashCode());
result = prime * result + ((baseCodePath == null) ? 0 : baseCodePath.hashCode());
return result;
@@ -364,7 +381,10 @@
if (!targetPackageName.equals(other.targetPackageName)) {
return false;
}
- if (!category.equals(other.category)) {
+ if (!Objects.equals(targetOverlayableName, other.targetOverlayableName)) {
+ return false;
+ }
+ if (!Objects.equals(category, other.category)) {
return false;
}
if (!baseCodePath.equals(other.baseCodePath)) {
@@ -375,7 +395,9 @@
@Override
public String toString() {
- return "OverlayInfo { overlay=" + packageName + ", target=" + targetPackageName + ", state="
- + state + " (" + stateToString(state) + "), userId=" + userId + " }";
+ return "OverlayInfo { overlay=" + packageName + ", targetPackage=" + targetPackageName
+ + ((targetOverlayableName == null) ? ""
+ : ", targetOverlyabale=" + targetOverlayableName)
+ + ", state=" + state + " (" + stateToString(state) + "), userId=" + userId + " }";
}
}
diff --git a/core/java/android/content/pm/PackageInfo.java b/core/java/android/content/pm/PackageInfo.java
index 725d601..d6fb28f 100644
--- a/core/java/android/content/pm/PackageInfo.java
+++ b/core/java/android/content/pm/PackageInfo.java
@@ -354,12 +354,12 @@
public String overlayTarget;
/**
- * What overlayable set of elements package, if any, this package will overlay.
+ * The name of the overlayable set of elements package, if any, this package will overlay.
*
* Overlayable name defined within the target package, or null.
* @hide
*/
- public String overlayTargetName;
+ public String targetOverlayableName;
/**
* The overlay category, if any, of this package
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 743a302..b480939 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -689,7 +689,7 @@
pi.restrictedAccountType = p.mRestrictedAccountType;
pi.requiredAccountType = p.mRequiredAccountType;
pi.overlayTarget = p.mOverlayTarget;
- pi.overlayTargetName = p.mOverlayTargetName;
+ pi.targetOverlayableName = p.mOverlayTargetName;
pi.overlayCategory = p.mOverlayCategory;
pi.overlayPriority = p.mOverlayPriority;
pi.mOverlayIsStatic = p.mOverlayIsStatic;
diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl
index b5c6604..e1d605e 100644
--- a/core/java/android/os/IPowerManager.aidl
+++ b/core/java/android/os/IPowerManager.aidl
@@ -53,10 +53,10 @@
boolean isPowerSaveMode();
PowerSaveState getPowerSaveState(int serviceType);
boolean setPowerSaveModeEnabled(boolean mode);
- boolean setDynamicPowerSavings(boolean dynamicPowerSavingsEnabled, int disableThreshold);
+ boolean setDynamicPowerSaveHint(boolean powerSaveHint, int disableThreshold);
boolean setAdaptivePowerSavePolicy(in BatterySaverPolicyConfig config);
boolean setAdaptivePowerSaveEnabled(boolean enabled);
- int getPowerSaveMode();
+ int getPowerSaveModeTrigger();
boolean isDeviceIdleMode();
boolean isLightDeviceIdleMode();
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 36bae2d..64e2f89 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -1460,7 +1460,7 @@
* an on/off switch for a subset of features.
* @hide
*
- * @param dynamicPowerSavingsEnabled A signal indicating to the system if it believes the
+ * @param powerSaveHint A signal indicating to the system if it believes the
* dynamic power savings behaviors should be activated.
* @param disableThreshold When the suggesting app believes it would be safe to disable dynamic
* power savings behaviors.
@@ -1471,10 +1471,9 @@
@SystemApi
@TestApi
@RequiresPermission(permission.POWER_SAVER)
- public boolean setDynamicPowerSavings(boolean dynamicPowerSavingsEnabled,
- int disableThreshold) {
+ public boolean setDynamicPowerSaveHint(boolean powerSaveHint, int disableThreshold) {
try {
- return mService.setDynamicPowerSavings(dynamicPowerSavingsEnabled, disableThreshold);
+ return mService.setDynamicPowerSaveHint(powerSaveHint, disableThreshold);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1525,54 +1524,54 @@
/**
* Indicates automatic battery saver toggling by the system will be based on percentage.
*
- * @see PowerManager#getPowerSaveMode()
+ * @see PowerManager#getPowerSaveModeTrigger()
*
* @hide
*/
@SystemApi
@TestApi
- public static final int POWER_SAVER_MODE_PERCENTAGE = 0;
+ public static final int POWER_SAVE_MODE_TRIGGER_PERCENTAGE = 0;
/**
* Indicates automatic battery saver toggling by the system will be based on the state
* of the dynamic power savings signal.
*
- * @see PowerManager#setDynamicPowerSavings(boolean, int)
- * @see PowerManager#getPowerSaveMode()
+ * @see PowerManager#setDynamicPowerSaveHint(boolean, int)
+ * @see PowerManager#getPowerSaveModeTrigger()
*
* @hide
*/
@SystemApi
@TestApi
- public static final int POWER_SAVER_MODE_DYNAMIC = 1;
+ public static final int POWER_SAVE_MODE_TRIGGER_DYNAMIC = 1;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(value = {
- POWER_SAVER_MODE_PERCENTAGE,
- POWER_SAVER_MODE_DYNAMIC
+ POWER_SAVE_MODE_TRIGGER_PERCENTAGE,
+ POWER_SAVE_MODE_TRIGGER_DYNAMIC
})
- public @interface AutoPowerSaverMode{}
+ public @interface AutoPowerSaveModeTriggers {}
/**
* Returns the current battery saver control mode. Values it may return are defined in
- * AutoPowerSaverMode. Note that this is a global device state, not a per user setting.
+ * AutoPowerSaveModeTriggers. Note that this is a global device state, not a per user setting.
*
* @return The current value power saver mode for the system.
*
- * @see AutoPowerSaverMode
- * @see PowerManager#getPowerSaveMode()
+ * @see AutoPowerSaveModeTriggers
+ * @see PowerManager#getPowerSaveModeTrigger()
* @hide
*/
- @AutoPowerSaverMode
+ @AutoPowerSaveModeTriggers
@SystemApi
@TestApi
@RequiresPermission(android.Manifest.permission.POWER_SAVER)
- public int getPowerSaveMode() {
+ public int getPowerSaveModeTrigger() {
try {
- return mService.getPowerSaveMode();
+ return mService.getPowerSaveModeTrigger();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index d4908ca..6dd7ecc 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -73,6 +73,7 @@
import android.os.DropBoxManager;
import android.os.IBinder;
import android.os.LocaleList;
+import android.os.PowerManager.AutoPowerSaveModeTriggers;
import android.os.Process;
import android.os.RemoteException;
import android.os.ResultReceiver;
@@ -12599,12 +12600,11 @@
/**
* Battery level [1-100] at which low power mode automatically turns on.
* If 0, it will not automatically turn on. For Q and newer, it will only automatically
- * turn on if the value is greater than 0 and the {@link #AUTOMATIC_POWER_SAVER_MODE}
+ * turn on if the value is greater than 0 and the {@link #AUTOMATIC_POWER_SAVE_MODE}
* setting is also set to
- * {@link android.os.PowerManager.AutoPowerSaverMode#POWER_SAVER_MODE_PERCENTAGE}.
- *
- * @see #AUTOMATIC_POWER_SAVER_MODE
- * @see android.os.PowerManager#getPowerSaveMode()
+ * {@link android.os.PowerManager.AutoPowerSaveMode#POWER_SAVE_MODE_TRIGGER_PERCENTAGE}.
+ * @see #AUTOMATIC_POWER_SAVE_MODE
+ * @see android.os.PowerManager#getPowerSaveModeTrigger()
* @hide
*/
public static final String LOW_POWER_MODE_TRIGGER_LEVEL = "low_power_trigger_level";
@@ -12614,22 +12614,22 @@
/**
* Whether battery saver is currently set to trigger based on percentage, dynamic power
- * savings trigger, or none. See {@link android.os.PowerManager.AutoPowerSaverMode} for
+ * savings trigger, or none. See {@link AutoPowerSaveModeTriggers} for
* accepted values.
*
* @hide
*/
@TestApi
- public static final String AUTOMATIC_POWER_SAVER_MODE = "automatic_power_saver_mode";
+ public static final String AUTOMATIC_POWER_SAVE_MODE = "automatic_power_save_mode";
- private static final Validator AUTOMATIC_POWER_SAVER_MODE_VALIDATOR =
+ private static final Validator AUTOMATIC_POWER_SAVE_MODE_VALIDATOR =
new SettingsValidators.DiscreteValueValidator(new String[] {"0", "1"});
/**
* The setting that backs the disable threshold for the setPowerSavingsWarning api in
* PowerManager
*
- * @see android.os.PowerManager#setDynamicPowerSavings(boolean, int)
+ * @see android.os.PowerManager#setDynamicPowerSaveHint(boolean, int)
* @hide
*/
@TestApi
@@ -12639,9 +12639,9 @@
new SettingsValidators.InclusiveIntegerRangeValidator(0, 100);
/**
- * The setting which backs the setDynamicPowerSavings api in PowerManager.
+ * The setting which backs the setDynamicPowerSaveHint api in PowerManager.
*
- * @see android.os.PowerManager#setDynamicPowerSavings(boolean, int)
+ * @see android.os.PowerManager#setDynamicPowerSaveHint(boolean, int)
* @hide
*/
@TestApi
@@ -13630,7 +13630,7 @@
VALIDATORS.put(LOW_POWER_MODE_TRIGGER_LEVEL, LOW_POWER_MODE_TRIGGER_LEVEL_VALIDATOR);
VALIDATORS.put(LOW_POWER_MODE_TRIGGER_LEVEL_MAX,
LOW_POWER_MODE_TRIGGER_LEVEL_VALIDATOR);
- VALIDATORS.put(AUTOMATIC_POWER_SAVER_MODE, AUTOMATIC_POWER_SAVER_MODE_VALIDATOR);
+ VALIDATORS.put(AUTOMATIC_POWER_SAVE_MODE, AUTOMATIC_POWER_SAVE_MODE_VALIDATOR);
VALIDATORS.put(DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD,
DYNAMIC_POWER_SAVINGS_VALIDATOR);
VALIDATORS.put(BLUETOOTH_ON, BLUETOOTH_ON_VALIDATOR);
diff --git a/core/java/android/service/contentcapture/ContentCaptureService.java b/core/java/android/service/contentcapture/ContentCaptureService.java
index df11397..988ddd2 100644
--- a/core/java/android/service/contentcapture/ContentCaptureService.java
+++ b/core/java/android/service/contentcapture/ContentCaptureService.java
@@ -298,12 +298,12 @@
/**
* Disables the Content Capture service for the given user.
*/
- public final void disableContentCaptureServices() {
- if (sDebug) Log.d(TAG, "disableContentCaptureServices()");
+ public final void disableSelf() {
+ if (sDebug) Log.d(TAG, "disableSelf()");
final IContentCaptureServiceCallback callback = mCallback;
if (callback == null) {
- Log.w(TAG, "disableContentCaptureServices(): no server callback");
+ Log.w(TAG, "disableSelf(): no server callback");
return;
}
try {
diff --git a/core/java/android/service/contentcapture/ContentCaptureServiceInfo.java b/core/java/android/service/contentcapture/ContentCaptureServiceInfo.java
index 6ecd82f..fb60619 100644
--- a/core/java/android/service/contentcapture/ContentCaptureServiceInfo.java
+++ b/core/java/android/service/contentcapture/ContentCaptureServiceInfo.java
@@ -139,6 +139,7 @@
mSettingsActivity = settingsActivity;
}
+ @NonNull
public ServiceInfo getServiceInfo() {
return mServiceInfo;
}
diff --git a/core/java/android/util/FeatureFlagUtils.java b/core/java/android/util/FeatureFlagUtils.java
index 04bb0e3..da6ef4c 100644
--- a/core/java/android/util/FeatureFlagUtils.java
+++ b/core/java/android/util/FeatureFlagUtils.java
@@ -59,7 +59,7 @@
DEFAULT_FLAGS.put(SCREENRECORD_LONG_PRESS, "false");
DEFAULT_FLAGS.put(GLOBAL_ACTIONS_GRID_ENABLED, "true");
DEFAULT_FLAGS.put(GLOBAL_ACTIONS_PANEL_ENABLED, "true");
- DEFAULT_FLAGS.put("settings_wifi_details_saved_screen", "false");
+ DEFAULT_FLAGS.put("settings_wifi_details_saved_screen", "true");
DEFAULT_FLAGS.put("settings_wifi_details_datausage_header", "false");
}
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index cd075bf..0043d32 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -88,10 +88,10 @@
private static native void nativeDestroy(long nativeObject);
private static native void nativeDisconnect(long nativeObject);
- private static native GraphicBuffer nativeScreenshot(IBinder displayToken,
+ private static native ScreenshotGraphicBuffer nativeScreenshot(IBinder displayToken,
Rect sourceCrop, int width, int height, boolean useIdentityTransform, int rotation,
boolean captureSecureLayers);
- private static native GraphicBuffer nativeCaptureLayers(IBinder layerHandleToken,
+ private static native ScreenshotGraphicBuffer nativeCaptureLayers(IBinder layerHandleToken,
Rect sourceCrop, float frameScale);
private static native long nativeCreateTransaction();
@@ -431,7 +431,52 @@
public static final int METADATA_TASK_ID = 3;
/**
+ * A wrapper around GraphicBuffer that contains extra information about how to
+ * interpret the screenshot GraphicBuffer.
+ * @hide
+ */
+ public static class ScreenshotGraphicBuffer {
+ private final GraphicBuffer mGraphicBuffer;
+ private final ColorSpace mColorSpace;
+
+ public ScreenshotGraphicBuffer(GraphicBuffer graphicBuffer, ColorSpace colorSpace) {
+ mGraphicBuffer = graphicBuffer;
+ mColorSpace = colorSpace;
+ }
+
+ /**
+ * Create ScreenshotGraphicBuffer from existing native GraphicBuffer object.
+ * @param width The width in pixels of the buffer
+ * @param height The height in pixels of the buffer
+ * @param format The format of each pixel as specified in {@link PixelFormat}
+ * @param usage Hint indicating how the buffer will be used
+ * @param unwrappedNativeObject The native object of GraphicBuffer
+ * @param namedColorSpace Integer value of a named color space {@link ColorSpace.Named}
+ */
+ private static ScreenshotGraphicBuffer createFromNative(int width, int height, int format,
+ int usage, long unwrappedNativeObject, int namedColorSpace) {
+ GraphicBuffer graphicBuffer = GraphicBuffer.createFromExisting(width, height, format,
+ usage, unwrappedNativeObject);
+ ColorSpace colorSpace = ColorSpace.get(ColorSpace.Named.values()[namedColorSpace]);
+ return new ScreenshotGraphicBuffer(graphicBuffer, colorSpace);
+ }
+
+ public ColorSpace getColorSpace() {
+ return mColorSpace;
+ }
+
+ public GraphicBuffer getGraphicBuffer() {
+ return mGraphicBuffer;
+ }
+ }
+
+ /**
* Builder class for {@link SurfaceControl} objects.
+ *
+ * By default the surface will be hidden, and have "unset" bounds, meaning it can
+ * be as large as the bounds of its parent if a buffer or child so requires.
+ *
+ * It is necessary to set at least a name via {@link Builder#setName}
*/
public static class Builder {
private SurfaceSession mSession;
@@ -466,11 +511,11 @@
@NonNull
public SurfaceControl build() {
if (mWidth < 0 || mHeight < 0) {
- throw new IllegalArgumentException(
+ throw new IllegalStateException(
"width and height must be positive or unset");
}
if ((mWidth > 0 || mHeight > 0) && (isColorLayerSet() || isContainerLayerSet())) {
- throw new IllegalArgumentException(
+ throw new IllegalStateException(
"Only buffer layers can set a valid buffer size.");
}
return new SurfaceControl(
@@ -860,7 +905,9 @@
* Release the local reference to the server-side surface. The surface
* may continue to exist on-screen as long as its parent continues
* to exist. To explicitly remove a surface from the screen use
- * {@link Transaction#reparent} with a null-parent.
+ * {@link Transaction#reparent} with a null-parent. After release,
+ * {@link #isValid} will return false and other methods will throw
+ * an exception.
*
* Always call release() when you're done with a SurfaceControl.
*/
@@ -902,7 +949,8 @@
/**
* Check whether this instance points to a valid layer with the system-compositor. For
- * example this may be false if construction failed, or the layer was released.
+ * example this may be false if construction failed, or the layer was released
+ * ({@link #release}).
*
* @return Whether this SurfaceControl is valid.
*/
@@ -1815,10 +1863,10 @@
throw new IllegalArgumentException("consumer must not be null");
}
- final GraphicBuffer buffer = screenshotToBuffer(display, sourceCrop, width, height,
- useIdentityTransform, rotation);
+ final ScreenshotGraphicBuffer buffer = screenshotToBuffer(display, sourceCrop, width,
+ height, useIdentityTransform, rotation);
try {
- consumer.attachAndQueueBuffer(buffer);
+ consumer.attachAndQueueBuffer(buffer.getGraphicBuffer());
} catch (RuntimeException e) {
Log.w(TAG, "Failed to take screenshot - " + e.getMessage());
}
@@ -1861,17 +1909,16 @@
}
SurfaceControl.rotateCropForSF(sourceCrop, rotation);
- final GraphicBuffer buffer = screenshotToBuffer(displayToken, sourceCrop, width, height,
- useIdentityTransform, rotation);
+ final ScreenshotGraphicBuffer buffer = screenshotToBuffer(displayToken, sourceCrop, width,
+ height, useIdentityTransform, rotation);
if (buffer == null) {
Log.w(TAG, "Failed to take screenshot");
return null;
}
- // TODO(b/116112787) Now that hardware bitmap creation can take color space, we
- // should continue to fix screenshot.
- return Bitmap.wrapHardwareBuffer(HardwareBuffer.createFromGraphicBuffer(buffer),
- ColorSpace.get(ColorSpace.Named.SRGB));
+ return Bitmap.wrapHardwareBuffer(
+ HardwareBuffer.createFromGraphicBuffer(buffer.getGraphicBuffer()),
+ buffer.getColorSpace());
}
/**
@@ -1897,8 +1944,8 @@
* @return Returns a GraphicBuffer that contains the captured content.
* @hide
*/
- public static GraphicBuffer screenshotToBuffer(IBinder display, Rect sourceCrop, int width,
- int height, boolean useIdentityTransform, int rotation) {
+ public static ScreenshotGraphicBuffer screenshotToBuffer(IBinder display, Rect sourceCrop,
+ int width, int height, boolean useIdentityTransform, int rotation) {
if (display == null) {
throw new IllegalArgumentException("displayToken must not be null");
}
@@ -1917,7 +1964,7 @@
*
* @hide
*/
- public static GraphicBuffer screenshotToBufferWithSecureLayersUnsafe(IBinder display,
+ public static ScreenshotGraphicBuffer screenshotToBufferWithSecureLayersUnsafe(IBinder display,
Rect sourceCrop, int width, int height, boolean useIdentityTransform,
int rotation) {
if (display == null) {
@@ -1951,7 +1998,7 @@
* @return Returns a GraphicBuffer that contains the layer capture.
* @hide
*/
- public static GraphicBuffer captureLayers(IBinder layerHandleToken, Rect sourceCrop,
+ public static ScreenshotGraphicBuffer captureLayers(IBinder layerHandleToken, Rect sourceCrop,
float frameScale) {
return nativeCaptureLayers(layerHandleToken, sourceCrop, frameScale);
}
@@ -2042,8 +2089,7 @@
}
/**
- * Close the transaction, if the transaction was not already applied this will cancel the
- * transaction.
+ * Release the native transaction object, without applying it.
*/
@Override
public void close() {
@@ -2128,8 +2174,8 @@
}
/**
- * Set the default buffer size for the SurfaceControl, if there is an
- * {@link Surface} assosciated with the control, then
+ * Set the default buffer size for the SurfaceControl, if there is a
+ * {@link Surface} associated with the control, then
* this will be the default size for buffers dequeued from it.
* @param sc The surface to set the buffer size for.
* @param w The default width
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index ee8d663..e931448 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -491,7 +491,7 @@
if (mBackgroundControl == null) {
return;
}
- if ((mSurfaceFlags & SurfaceControl.OPAQUE) != 0) {
+ if ((mSubLayer > 0) && ((mSurfaceFlags & SurfaceControl.OPAQUE) != 0)) {
mBackgroundControl.show();
mBackgroundControl.setLayer(Integer.MIN_VALUE);
} else {
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index a4d80dc..9101c36 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -142,7 +142,7 @@
* This field should be made private, so it is hidden from the SDK.
* {@hide}
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123768704)
protected OnHierarchyChangeListener mOnHierarchyChangeListener;
// The view contained within this ViewGroup that has or contains focus.
@@ -239,7 +239,7 @@
@ViewDebug.FlagToString(mask = FLAG_PADDING_NOT_NULL, equals = FLAG_PADDING_NOT_NULL,
name = "PADDING_NOT_NULL")
}, formatToHexString = true)
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123769411)
protected int mGroupFlags;
/**
@@ -314,7 +314,7 @@
*
* {@hide}
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123769647)
protected static final int FLAG_SUPPORT_STATIC_TRANSFORMATIONS = 0x800;
// UNUSED FLAG VALUE: 0x1000;
@@ -368,7 +368,7 @@
* When set, this ViewGroup should not intercept touch events.
* {@hide}
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123983692)
protected static final int FLAG_DISALLOW_INTERCEPT = 0x80000;
/**
diff --git a/core/java/android/view/WindowManagerPolicyConstants.java b/core/java/android/view/WindowManagerPolicyConstants.java
index 35ed7bf..46a59f0 100644
--- a/core/java/android/view/WindowManagerPolicyConstants.java
+++ b/core/java/android/view/WindowManagerPolicyConstants.java
@@ -54,6 +54,16 @@
int NAV_BAR_RIGHT = 1 << 1;
int NAV_BAR_BOTTOM = 1 << 2;
+ // Navigation bar interaction modes
+ int NAV_BAR_MODE_3BUTTON = 0;
+ int NAV_BAR_MODE_2BUTTON = 1;
+ int NAV_BAR_MODE_GESTURAL = 2;
+
+ // Associated overlays for each nav bar mode
+ String NAV_BAR_MODE_3BUTTON_OVERLAY = "com.android.internal.systemui.navbar.threebutton";
+ String NAV_BAR_MODE_2BUTTON_OVERLAY = "com.android.internal.systemui.navbar.twobutton";
+ String NAV_BAR_MODE_GESTURAL_OVERLAY = "com.android.internal.systemui.navbar.gestural";
+
/**
* Broadcast sent when a user activity is detected.
*/
diff --git a/core/java/android/view/contentcapture/ContentCaptureManager.java b/core/java/android/view/contentcapture/ContentCaptureManager.java
index a3e6549..afddc38 100644
--- a/core/java/android/view/contentcapture/ContentCaptureManager.java
+++ b/core/java/android/view/contentcapture/ContentCaptureManager.java
@@ -32,6 +32,7 @@
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
+import android.os.ServiceManager;
import android.util.Log;
import android.view.contentcapture.ContentCaptureSession.FlushReason;
@@ -52,11 +53,13 @@
private static final String TAG = ContentCaptureManager.class.getSimpleName();
/** @hide */
+ public static final int RESULT_CODE_OK = 0;
+ /** @hide */
public static final int RESULT_CODE_TRUE = 1;
/** @hide */
public static final int RESULT_CODE_FALSE = 2;
/** @hide */
- public static final int RESULT_CODE_NOT_SERVICE = -1;
+ public static final int RESULT_CODE_SECURITY_EXCEPTION = -1;
/**
* Timeout for calls to system_server.
@@ -297,6 +300,34 @@
}
/**
+ * Gets the (optional) intent used to launch the service-specific settings.
+ *
+ * <p>This method is static because it's called by Settings, which might not be whitelisted
+ * for content capture (in which case the ContentCaptureManager on its context would be null).
+ *
+ * @hide
+ */
+ @Nullable
+ public static ComponentName getServiceSettingsComponentName() {
+ final IBinder binder = ServiceManager
+ .checkService(Context.CONTENT_CAPTURE_MANAGER_SERVICE);
+ if (binder == null) return null;
+
+ final IContentCaptureManager service = IContentCaptureManager.Stub.asInterface(binder);
+ final SyncResultReceiver resultReceiver = new SyncResultReceiver(SYNC_CALLS_TIMEOUT_MS);
+ try {
+ service.getServiceSettingsActivity(resultReceiver);
+ final int resultCode = resultReceiver.getIntResult();
+ if (resultCode == RESULT_CODE_SECURITY_EXCEPTION) {
+ throw new SecurityException(resultReceiver.getStringResult());
+ }
+ return resultReceiver.getParcelableResult();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Checks whether content capture is enabled for this activity.
*
* <p>There are many reasons it could be disabled, such as:
@@ -365,7 +396,7 @@
return true;
case RESULT_CODE_FALSE:
return false;
- case RESULT_CODE_NOT_SERVICE:
+ case RESULT_CODE_SECURITY_EXCEPTION:
throw new SecurityException("caller is not user's ContentCapture service");
default:
Log.wtf(TAG, "received invalid result: " + resultCode);
diff --git a/core/java/android/view/contentcapture/IContentCaptureManager.aidl b/core/java/android/view/contentcapture/IContentCaptureManager.aidl
index e3b0372..15fbaa2 100644
--- a/core/java/android/view/contentcapture/IContentCaptureManager.aidl
+++ b/core/java/android/view/contentcapture/IContentCaptureManager.aidl
@@ -67,4 +67,9 @@
* Returns whether the content capture feature is enabled for the calling user.
*/
void isContentCaptureFeatureEnabled(in IResultReceiver result);
+
+ /**
+ * Returns a ComponentName with the name of custom service activity, if defined.
+ */
+ void getServiceSettingsActivity(in IResultReceiver result);
}
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index 702b507..54fff9b 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -237,7 +237,7 @@
if (DEBUG) {
Log.d(TAG, "CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT; unbinding services");
}
- if (isDestroyed()) {
+ if (mChooserListAdapter == null || isDestroyed()) {
break;
}
unbindRemainingServices();
@@ -822,6 +822,7 @@
mRefinementResultReceiver = null;
}
unbindRemainingServices();
+ mChooserHandler.removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT);
mChooserHandler.removeMessages(CHOOSER_TARGET_SERVICE_RESULT);
if (USE_PREDICTION_MANAGER_FOR_DIRECT_TARGETS) {
mAppPredictor.unregisterPredictionUpdates(mAppPredictorCallback);
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index 4a6c72b..94f96ba 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -126,6 +126,41 @@
jfieldID white;
} gDisplayPrimariesClassInfo;
+static struct {
+ jclass clazz;
+ jmethodID builder;
+} gScreenshotGraphicBufferClassInfo;
+
+class JNamedColorSpace {
+public:
+ // ColorSpace.Named.SRGB.ordinal() = 0;
+ static constexpr jint SRGB = 0;
+
+ // ColorSpace.Named.DISPLAY_P3.ordinal() = 6;
+ static constexpr jint DISPLAY_P3 = 6;
+};
+
+constexpr jint fromDataspaceToNamedColorSpaceValue(const ui::Dataspace dataspace) {
+ switch (dataspace) {
+ case ui::Dataspace::DISPLAY_P3:
+ return JNamedColorSpace::DISPLAY_P3;
+ default:
+ return JNamedColorSpace::SRGB;
+ }
+}
+
+constexpr ui::Dataspace pickDataspaceFromColorMode(const ui::ColorMode colorMode) {
+ switch (colorMode) {
+ case ui::ColorMode::DISPLAY_P3:
+ case ui::ColorMode::BT2100_PQ:
+ case ui::ColorMode::BT2100_HLG:
+ case ui::ColorMode::DISPLAY_BT2020:
+ return ui::Dataspace::DISPLAY_P3;
+ default:
+ return ui::Dataspace::V0_SRGB;
+ }
+}
+
// ----------------------------------------------------------------------------
static jlong nativeCreateTransaction(JNIEnv* env, jclass clazz) {
@@ -210,9 +245,12 @@
if (displayToken == NULL) {
return NULL;
}
+ const ui::ColorMode colorMode = SurfaceComposerClient::getActiveColorMode(displayToken);
+ const ui::Dataspace dataspace = pickDataspaceFromColorMode(colorMode);
+
Rect sourceCrop = rectFromObj(env, sourceCropObj);
sp<GraphicBuffer> buffer;
- status_t res = ScreenshotClient::capture(displayToken, ui::Dataspace::V0_SRGB,
+ status_t res = ScreenshotClient::capture(displayToken, dataspace,
ui::PixelFormat::RGBA_8888,
sourceCrop, width, height,
useIdentityTransform, rotation, captureSecureLayers, &buffer);
@@ -220,13 +258,15 @@
return NULL;
}
- return env->CallStaticObjectMethod(gGraphicBufferClassInfo.clazz,
- gGraphicBufferClassInfo.builder,
+ const jint namedColorSpace = fromDataspaceToNamedColorSpaceValue(dataspace);
+ return env->CallStaticObjectMethod(gScreenshotGraphicBufferClassInfo.clazz,
+ gScreenshotGraphicBufferClassInfo.builder,
buffer->getWidth(),
buffer->getHeight(),
buffer->getPixelFormat(),
(jint)buffer->getUsage(),
- (jlong)buffer.get());
+ (jlong)buffer.get(),
+ namedColorSpace);
}
static jobject nativeCaptureLayers(JNIEnv* env, jclass clazz, jobject layerHandleToken,
@@ -243,20 +283,23 @@
}
sp<GraphicBuffer> buffer;
- status_t res = ScreenshotClient::captureChildLayers(layerHandle, ui::Dataspace::V0_SRGB,
+ const ui::Dataspace dataspace = ui::Dataspace::V0_SRGB;
+ status_t res = ScreenshotClient::captureChildLayers(layerHandle, dataspace,
ui::PixelFormat::RGBA_8888, sourceCrop,
frameScale, &buffer);
if (res != NO_ERROR) {
return NULL;
}
- return env->CallStaticObjectMethod(gGraphicBufferClassInfo.clazz,
- gGraphicBufferClassInfo.builder,
+ const jint namedColorSpace = fromDataspaceToNamedColorSpaceValue(dataspace);
+ return env->CallStaticObjectMethod(gScreenshotGraphicBufferClassInfo.clazz,
+ gScreenshotGraphicBufferClassInfo.builder,
buffer->getWidth(),
buffer->getHeight(),
buffer->getPixelFormat(),
(jint)buffer->getUsage(),
- (jlong)buffer.get());
+ (jlong)buffer.get(),
+ namedColorSpace);
}
static void nativeApplyTransaction(JNIEnv* env, jclass clazz, jlong transactionObj, jboolean sync) {
@@ -1306,9 +1349,13 @@
(void*)nativeSetOverrideScalingMode },
{"nativeGetHandle", "(J)Landroid/os/IBinder;",
(void*)nativeGetHandle },
- {"nativeScreenshot", "(Landroid/os/IBinder;Landroid/graphics/Rect;IIZIZ)Landroid/graphics/GraphicBuffer;",
+ {"nativeScreenshot",
+ "(Landroid/os/IBinder;Landroid/graphics/Rect;IIZIZ)"
+ "Landroid/view/SurfaceControl$ScreenshotGraphicBuffer;",
(void*)nativeScreenshot },
- {"nativeCaptureLayers", "(Landroid/os/IBinder;Landroid/graphics/Rect;F)Landroid/graphics/GraphicBuffer;",
+ {"nativeCaptureLayers",
+ "(Landroid/os/IBinder;Landroid/graphics/Rect;F)"
+ "Landroid/view/SurfaceControl$ScreenshotGraphicBuffer;",
(void*)nativeCaptureLayers },
{"nativeSetInputWindowInfo", "(JJLandroid/view/InputWindowHandle;)V",
(void*)nativeSetInputWindowInfo },
@@ -1386,6 +1433,14 @@
gGraphicBufferClassInfo.builder = GetStaticMethodIDOrDie(env, graphicsBufferClazz,
"createFromExisting", "(IIIIJ)Landroid/graphics/GraphicBuffer;");
+ jclass screenshotGraphicsBufferClazz = FindClassOrDie(env,
+ "android/view/SurfaceControl$ScreenshotGraphicBuffer");
+ gScreenshotGraphicBufferClassInfo.clazz =
+ MakeGlobalRefOrDie(env, screenshotGraphicsBufferClazz);
+ gScreenshotGraphicBufferClassInfo.builder = GetStaticMethodIDOrDie(env,
+ screenshotGraphicsBufferClazz,
+ "createFromNative", "(IIIIJI)Landroid/view/SurfaceControl$ScreenshotGraphicBuffer;");
+
jclass displayedContentSampleClazz = FindClassOrDie(env,
"android/hardware/display/DisplayedContentSample");
gDisplayedContentSampleClassInfo.clazz = MakeGlobalRefOrDie(env, displayedContentSampleClazz);
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 14edf6f..14202f2 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -3222,6 +3222,12 @@
-->
<integer name="config_navBarOpacityMode">0</integer>
+ <!-- Controls the navigation bar interaction mode:
+ 0: 3 button mode (back, home, overview buttons)
+ 1: 2 button mode (back, home buttons + swipe up for overview)
+ 2: gestures only for back, home and overview -->
+ <integer name="config_navBarInteractionMode">0</integer>
+
<!-- Default insets [LEFT/RIGHTxTOP/BOTTOM] from the screen edge for picture-in-picture windows.
These values are in DPs and will be converted to pixel sizes internally. -->
<string translatable="false" name="config_defaultPictureInPictureScreenEdgeInsets">16x16</string>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 93c8458..8797b0e 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2832,6 +2832,7 @@
<java-symbol type="string" name="config_packagedKeyboardName" />
<java-symbol type="bool" name="config_forceWindowDrawsStatusBarBackground" />
<java-symbol type="integer" name="config_navBarOpacityMode" />
+ <java-symbol type="integer" name="config_navBarInteractionMode" />
<java-symbol type="color" name="system_bar_background_semi_transparent" />
<!-- EditText suggestion popup. -->
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index 85947bd..8fc6a96 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -129,7 +129,7 @@
Settings.Global.AUTOFILL_LOGGING_LEVEL,
Settings.Global.AUTOFILL_MAX_PARTITIONS_SIZE,
Settings.Global.AUTOFILL_MAX_VISIBLE_DATASETS,
- Settings.Global.AUTOMATIC_POWER_SAVER_MODE,
+ Settings.Global.AUTOMATIC_POWER_SAVE_MODE,
Settings.Global.BACKGROUND_ACTIVITY_STARTS_ENABLED,
Settings.Global.BACKGROUND_ACTIVITY_STARTS_PACKAGE_NAMES_WHITELIST,
Settings.Global.BATTERY_CHARGING_STATE_UPDATE_DELAY,
diff --git a/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java b/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java
index 185fa07..8c2375e 100644
--- a/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java
+++ b/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java
@@ -599,7 +599,7 @@
mActivityRule.launchActivity(Intent.createChooser(sendIntent, null));
waitForIdle();
- verify(mockLogger, Mockito.times(2)).write(logMakerCaptor.capture());
+ verify(mockLogger, Mockito.times(3)).write(logMakerCaptor.capture());
// First invocation is from onCreate
assertThat(logMakerCaptor.getAllValues().get(1).getCategory(),
is(MetricsEvent.ACTION_SHARE_WITH_PREVIEW));
@@ -629,7 +629,7 @@
ArgumentCaptor<LogMaker> logMakerCaptor = ArgumentCaptor.forClass(LogMaker.class);
mActivityRule.launchActivity(Intent.createChooser(sendIntent, null));
waitForIdle();
- verify(mockLogger, Mockito.times(2)).write(logMakerCaptor.capture());
+ verify(mockLogger, Mockito.times(3)).write(logMakerCaptor.capture());
// First invocation is from onCreate
assertThat(logMakerCaptor.getAllValues().get(1).getCategory(),
is(MetricsEvent.ACTION_SHARE_WITH_PREVIEW));
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml
index aa1a217..afb5071 100644
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -308,6 +308,8 @@
<permission name="android.permission.STATUS_BAR_SERVICE"/>
<permission name="android.permission.REQUEST_INCIDENT_REPORT_APPROVAL"/>
<permission name="android.permission.CONTROL_KEYGUARD_SECURE_NOTIFICATIONS"/>
+ <permission name="android.permission.SET_WALLPAPER" />
+ <permission name="android.permission.SET_WALLPAPER_COMPONENT" />
</privapp-permissions>
<privapp-permissions package="com.android.statementservice">
diff --git a/packages/SettingsLib/src/com/android/settingslib/fuelgauge/BatterySaverUtils.java b/packages/SettingsLib/src/com/android/settingslib/fuelgauge/BatterySaverUtils.java
index b34f445..b025df4 100644
--- a/packages/SettingsLib/src/com/android/settingslib/fuelgauge/BatterySaverUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/fuelgauge/BatterySaverUtils.java
@@ -185,14 +185,14 @@
*/
public static void revertScheduleToNoneIfNeeded(Context context) {
ContentResolver resolver = context.getContentResolver();
- final int currentMode = Global.getInt(resolver, Global.AUTOMATIC_POWER_SAVER_MODE,
- PowerManager.POWER_SAVER_MODE_PERCENTAGE);
+ final int currentMode = Global.getInt(resolver, Global.AUTOMATIC_POWER_SAVE_MODE,
+ PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE);
boolean providerConfigured = !TextUtils.isEmpty(context.getString(
com.android.internal.R.string.config_batterySaverScheduleProvider));
- if (currentMode == PowerManager.POWER_SAVER_MODE_DYNAMIC && !providerConfigured) {
+ if (currentMode == PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC && !providerConfigured) {
Global.putInt(resolver, Global.LOW_POWER_MODE_TRIGGER_LEVEL, 0);
- Global.putInt(resolver, Global.AUTOMATIC_POWER_SAVER_MODE,
- PowerManager.POWER_SAVER_MODE_PERCENTAGE);
+ Global.putInt(resolver, Global.AUTOMATIC_POWER_SAVE_MODE,
+ PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE);
}
}
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index a33f9a8..de7202c 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -844,7 +844,7 @@
Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL_MAX,
GlobalSettingsProto.LowPowerMode.TRIGGER_LEVEL_MAX);
dumpSetting(s, p,
- Settings.Global.AUTOMATIC_POWER_SAVER_MODE,
+ Settings.Global.AUTOMATIC_POWER_SAVE_MODE,
GlobalSettingsProto.LowPowerMode.AUTOMATIC_POWER_SAVER_MODE);
dumpSetting(s, p,
Settings.Global.LOW_POWER_MODE_STICKY,
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 9e46ad6..7337cdb 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -19,6 +19,12 @@
import static android.os.Process.ROOT_UID;
import static android.os.Process.SHELL_UID;
import static android.os.Process.SYSTEM_UID;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON_OVERLAY;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY;
import android.Manifest;
import android.annotation.NonNull;
@@ -33,6 +39,8 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.om.IOverlayManager;
+import android.content.om.OverlayInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
import android.content.pm.PackageInfo;
@@ -3235,7 +3243,7 @@
}
private final class UpgradeController {
- private static final int SETTINGS_VERSION = 176;
+ private static final int SETTINGS_VERSION = 177;
private final int mUserId;
@@ -4311,6 +4319,57 @@
currentVersion = 176;
}
+ if (currentVersion == 176) {
+ // Version 176: Migrate the existing swipe up setting into the resource overlay
+ // for the navigation bar interaction mode.
+
+ final IOverlayManager overlayManager = IOverlayManager.Stub.asInterface(
+ ServiceManager.getService(Context.OVERLAY_SERVICE));
+ int navBarMode = -1;
+
+ // Migrate the swipe up setting only if it is set
+ final SettingsState secureSettings = getSecureSettingsLocked(userId);
+ final Setting swipeUpSetting = secureSettings.getSettingLocked(
+ Secure.SWIPE_UP_TO_SWITCH_APPS_ENABLED);
+ if (swipeUpSetting != null && !swipeUpSetting.isNull()) {
+ navBarMode = swipeUpSetting.getValue().equals("1")
+ ? NAV_BAR_MODE_2BUTTON
+ : NAV_BAR_MODE_3BUTTON;
+ }
+
+ // Temporary: Only for migration for dogfooders, to be removed
+ try {
+ final OverlayInfo info = overlayManager.getOverlayInfo(
+ "com.android.internal.experiment.navbar.type.inset",
+ UserHandle.USER_CURRENT);
+ if (info != null && info.isEnabled()) {
+ navBarMode = NAV_BAR_MODE_GESTURAL;
+ }
+ } catch (RemoteException e) {
+ // Ingore, fall through
+ }
+
+ if (navBarMode != -1) {
+ try {
+ overlayManager.setEnabled(NAV_BAR_MODE_3BUTTON_OVERLAY,
+ navBarMode == NAV_BAR_MODE_3BUTTON,
+ UserHandle.USER_CURRENT);
+ overlayManager.setEnabled(NAV_BAR_MODE_2BUTTON_OVERLAY,
+ navBarMode == NAV_BAR_MODE_2BUTTON,
+ UserHandle.USER_CURRENT);
+ overlayManager.setEnabled(NAV_BAR_MODE_GESTURAL_OVERLAY,
+ navBarMode == NAV_BAR_MODE_GESTURAL,
+ UserHandle.USER_CURRENT);
+ } catch (RemoteException e) {
+ throw new IllegalStateException(
+ "Failed to set nav bar interaction mode overlay");
+ }
+ }
+
+ currentVersion = 177;
+ }
+
+
// vXXX: Add new settings above this point.
if (currentVersion != newVersion) {
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index 441f88c..d6e61eb 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -182,6 +182,10 @@
<!-- Permission needed to run keyguard manager tests in CTS -->
<uses-permission android:name="android.permission.CONTROL_KEYGUARD_SECURE_NOTIFICATIONS" />
+ <!-- Permission needed to test wallpaper component -->
+ <uses-permission android:name="android.permission.SET_WALLPAPER" />
+ <uses-permission android:name="android.permission.SET_WALLPAPER_COMPONENT" />
+
<application android:label="@string/app_label"
android:defaultToDeviceProtectedStorage="true"
android:directBootAware="true">
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/VolumeDialogController.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/VolumeDialogController.java
index 3d2f570..0a0530c0 100644
--- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/VolumeDialogController.java
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/VolumeDialogController.java
@@ -60,6 +60,7 @@
boolean areCaptionsEnabled();
void setCaptionsEnabled(boolean isEnabled);
+ boolean isCaptionStreamOptedOut();
void getCaptionsComponentState(boolean fromTooltip);
diff --git a/packages/SystemUI/res/color/caption_tint_color_selector.xml b/packages/SystemUI/res/color/caption_tint_color_selector.xml
new file mode 100644
index 0000000..30843ec
--- /dev/null
+++ b/packages/SystemUI/res/color/caption_tint_color_selector.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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
+ -->
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:sysui="http://schemas.android.com/apk/res-auto">
+ <item sysui:optedOut="true"
+ android:color="?android:attr/colorButtonNormal"/>
+
+ <item android:color="?android:attr/colorAccent"/>
+</selector>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/qs_footer_impl.xml b/packages/SystemUI/res/layout/qs_footer_impl.xml
index 6c8110b..a02962e 100644
--- a/packages/SystemUI/res/layout/qs_footer_impl.xml
+++ b/packages/SystemUI/res/layout/qs_footer_impl.xml
@@ -92,7 +92,6 @@
android:layout_width="@dimen/multi_user_avatar_expanded_size"
android:layout_height="@dimen/multi_user_avatar_expanded_size"
android:layout_gravity="center"
- android:tint="?android:attr/colorAccent"
android:scaleType="centerInside"/>
</com.android.systemui.statusbar.phone.MultiUserSwitch>
diff --git a/packages/SystemUI/res/layout/volume_dialog.xml b/packages/SystemUI/res/layout/volume_dialog.xml
index 1d0a242..d1c80c4 100644
--- a/packages/SystemUI/res/layout/volume_dialog.xml
+++ b/packages/SystemUI/res/layout/volume_dialog.xml
@@ -15,6 +15,7 @@
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:sysui="http://schemas.android.com/apk/res-auto"
android:id="@+id/volume_dialog_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -117,16 +118,17 @@
android:clipToPadding="false"
android:translationZ="@dimen/volume_dialog_elevation"
android:background="@drawable/rounded_bg_full">
- <com.android.keyguard.AlphaOptimizedImageButton
+ <com.android.systemui.volume.CaptionsToggleImageButton
android:id="@+id/odi_captions_icon"
android:src="@drawable/ic_volume_odi_captions_disabled"
style="@style/VolumeButtons"
android:background="@drawable/rounded_ripple"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:tint="@color/accent_tint_color_selector"
+ android:tint="@color/caption_tint_color_selector"
android:layout_gravity="center"
- android:soundEffectsEnabled="false" />
+ android:soundEffectsEnabled="false"
+ sysui:optedOut="false"/>
</FrameLayout>
</LinearLayout>
diff --git a/packages/SystemUI/res/values/attrs.xml b/packages/SystemUI/res/values/attrs.xml
index 27d2bcd..e0bcf24 100644
--- a/packages/SystemUI/res/values/attrs.xml
+++ b/packages/SystemUI/res/values/attrs.xml
@@ -146,5 +146,9 @@
<attr name="showAirplaneMode" format="boolean" />
</declare-styleable>
+ <declare-styleable name="CaptionsToggleImageButton">
+ <attr name="optedOut" format="boolean" />
+ </declare-styleable>
+
</resources>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 265c620..62309fd 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -549,11 +549,11 @@
<!-- Content description of the do not disturb tile in quick settings when on in alarms only (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_quick_settings_dnd_alarms_on">alarms only</string>
<!-- Content description of the do not disturb tile in quick settings (not shown on the screen). [CHAR LIMIT=NONE] -->
- <string name="accessibility_quick_settings_dnd">Do not disturb.</string>
+ <string name="accessibility_quick_settings_dnd">Do Not Disturb.</string>
<!-- Announcement made when do not disturb changes to off (not shown on the screen). [CHAR LIMIT=NONE] -->
- <string name="accessibility_quick_settings_dnd_changed_off">Do not disturb turned off.</string>
+ <string name="accessibility_quick_settings_dnd_changed_off">Do Not Disturb turned off.</string>
<!-- Announcement made when do not disturb changes to on (not shown on the screen). [CHAR LIMIT=NONE] -->
- <string name="accessibility_quick_settings_dnd_changed_on">Do not disturb turned on.</string>
+ <string name="accessibility_quick_settings_dnd_changed_on">Do Not Disturb turned on.</string>
<!-- Content description of the bluetooth tile in quick settings (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_quick_settings_bluetooth">Bluetooth.</string>
<!-- Content description of the bluetooth tile in quick settings when off (not shown on the screen). [CHAR LIMIT=NONE] -->
@@ -699,7 +699,7 @@
<!-- QuickSettings: Onboarding text that introduces users to long press on an option in order to view the option's menu in Settings [CHAR LIMIT=NONE] -->
<string name="quick_settings_header_onboarding_text">Touch & hold icons for more options</string>
<!-- QuickSettings: Do not disturb [CHAR LIMIT=NONE] -->
- <string name="quick_settings_dnd_label">Do not disturb</string>
+ <string name="quick_settings_dnd_label">Do Not Disturb</string>
<!-- QuickSettings: Do not disturb - Priority only [CHAR LIMIT=NONE] -->
<string name="quick_settings_dnd_priority_label">Priority only</string>
<!-- QuickSettings: Do not disturb - Alarms only [CHAR LIMIT=NONE] -->
@@ -1814,14 +1814,14 @@
<string name="tuner_full_zen_title">Show with volume controls</string>
<!-- SysUI Tuner: Label for screen about do not disturb settings [CHAR LIMIT=60] -->
- <string name="volume_and_do_not_disturb">Do not disturb</string>
+ <string name="volume_and_do_not_disturb">Do Not Disturb</string>
<!-- SysUI Tuner: Switch to control whether volume buttons enter/exit do
not disturb [CHAR LIMIT=60] -->
<string name="volume_dnd_silent">Volume buttons shortcut</string>
<!-- SysUI Tuner: Switch to control volume up behavior [CHAR LIMIT=60] -->
- <string name="volume_up_silent">Exit do not disturb on volume up</string>
+ <string name="volume_up_silent">Exit Do Not Disturb on volume up</string>
<!-- Name of the battery icon in status bar [CHAR LIMIT=30] -->
<string name="battery">Battery</string>
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
index 6ae2b45..fd92e9e 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
@@ -1,5 +1,7 @@
package com.android.keyguard;
+import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
+
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
@@ -24,8 +26,8 @@
import androidx.annotation.VisibleForTesting;
import com.android.internal.colorextraction.ColorExtractor;
+import com.android.internal.colorextraction.ColorExtractor.OnColorsChangedListener;
import com.android.keyguard.clock.ClockManager;
-import com.android.systemui.Dependency;
import com.android.systemui.Interpolators;
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.plugins.ClockPlugin;
@@ -37,37 +39,65 @@
import java.util.Arrays;
import java.util.TimeZone;
+import javax.inject.Inject;
+import javax.inject.Named;
+
/**
* Switch to show plugin clock when plugin is connected, otherwise it will show default clock.
*/
public class KeyguardClockSwitch extends RelativeLayout {
+ /**
+ * Controller used to track StatusBar state to know when to show the big_clock_container.
+ */
+ private final StatusBarStateController mStatusBarStateController;
+
+ /**
+ * Color extractor used to apply colors from wallpaper to custom clock faces.
+ */
+ private final SysuiColorExtractor mSysuiColorExtractor;
+
+ /**
+ * Manager used to know when to show a custom clock face.
+ */
+ private final ClockManager mClockManager;
+
+ /**
+ * Layout transition that scales the default clock face.
+ */
private final Transition mTransition;
+
/**
* Optional/alternative clock injected via plugin.
*/
private ClockPlugin mClockPlugin;
+
/**
* Default clock.
*/
private TextClock mClockView;
+
/**
* Frame for default and custom clock.
*/
private FrameLayout mSmallClockFrame;
+
/**
* Container for big custom clock.
*/
private ViewGroup mBigClockContainer;
+
/**
* Status area (date and other stuff) shown below the clock. Plugin can decide whether or not to
* show it below the alternate clock.
*/
private View mKeyguardStatusArea;
+
/**
* Maintain state so that a newly connected plugin can be initialized.
*/
private float mDarkAmount;
+
/**
* If the Keyguard Slice has a header (big center-aligned text.)
*/
@@ -96,22 +126,20 @@
*
* The color palette changes when the wallpaper is changed.
*/
- private SysuiColorExtractor.OnColorsChangedListener mColorsListener = (extractor, which) -> {
+ private final OnColorsChangedListener mColorsListener = (extractor, which) -> {
if ((which & WallpaperManager.FLAG_LOCK) != 0) {
- if (extractor instanceof SysuiColorExtractor) {
- updateColors((SysuiColorExtractor) extractor);
- } else {
- updateColors(Dependency.get(SysuiColorExtractor.class));
- }
+ updateColors();
}
};
- public KeyguardClockSwitch(Context context) {
- this(context, null);
- }
-
- public KeyguardClockSwitch(Context context, AttributeSet attrs) {
+ @Inject
+ public KeyguardClockSwitch(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
+ StatusBarStateController statusBarStateController, SysuiColorExtractor colorExtractor,
+ ClockManager clockManager) {
super(context, attrs);
+ mStatusBarStateController = statusBarStateController;
+ mSysuiColorExtractor = colorExtractor;
+ mClockManager = clockManager;
mTransition = new ClockBoundsTransition();
}
@@ -133,22 +161,18 @@
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
- Dependency.get(ClockManager.class).addOnClockChangedListener(mClockChangedListener);
- StatusBarStateController stateController = Dependency.get(StatusBarStateController.class);
- stateController.addCallback(mStateListener);
- mStateListener.onStateChanged(stateController.getState());
- SysuiColorExtractor colorExtractor = Dependency.get(SysuiColorExtractor.class);
- colorExtractor.addOnColorsChangedListener(mColorsListener);
- updateColors(colorExtractor);
+ mClockManager.addOnClockChangedListener(mClockChangedListener);
+ mStatusBarStateController.addCallback(mStateListener);
+ mSysuiColorExtractor.addOnColorsChangedListener(mColorsListener);
+ updateColors();
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
- Dependency.get(ClockManager.class).removeOnClockChangedListener(mClockChangedListener);
- Dependency.get(StatusBarStateController.class).removeCallback(mStateListener);
- Dependency.get(SysuiColorExtractor.class)
- .removeOnColorsChangedListener(mColorsListener);
+ mClockManager.removeOnClockChangedListener(mClockChangedListener);
+ mStatusBarStateController.removeCallback(mStateListener);
+ mSysuiColorExtractor.removeOnColorsChangedListener(mColorsListener);
setClockPlugin(null);
}
@@ -290,9 +314,9 @@
}
}
- private void updateColors(SysuiColorExtractor colorExtractor) {
- ColorExtractor.GradientColors colors = colorExtractor.getColors(WallpaperManager.FLAG_LOCK,
- true);
+ private void updateColors() {
+ ColorExtractor.GradientColors colors = mSysuiColorExtractor.getColors(
+ WallpaperManager.FLAG_LOCK, true);
mSupportsDarkText = colors.supportsDarkText();
mColorPalette = colors.getColorPalette();
if (mClockPlugin != null) {
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java
index 9dd9717..ae8bc52 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java
@@ -28,9 +28,12 @@
import android.util.SparseArray;
import android.view.Display;
import android.view.DisplayInfo;
+import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
+import com.android.systemui.util.InjectionInflationController;
+
// TODO(multi-display): Support multiple external displays
public class KeyguardDisplayManager {
protected static final String TAG = "KeyguardDisplayManager";
@@ -38,6 +41,7 @@
private final MediaRouter mMediaRouter;
private final DisplayManager mDisplayService;
+ private final InjectionInflationController mInjectableInflater;
private final Context mContext;
private boolean mShowing;
@@ -75,8 +79,10 @@
}
};
- public KeyguardDisplayManager(Context context) {
+ public KeyguardDisplayManager(Context context,
+ InjectionInflationController injectableInflater) {
mContext = context;
+ mInjectableInflater = injectableInflater;
mMediaRouter = mContext.getSystemService(MediaRouter.class);
mDisplayService = mContext.getSystemService(DisplayManager.class);
mDisplayService.registerDisplayListener(mDisplayListener, null /* handler */);
@@ -110,7 +116,7 @@
final int displayId = display.getDisplayId();
Presentation presentation = mPresentations.get(displayId);
if (presentation == null) {
- presentation = new KeyguardPresentation(mContext, display);
+ presentation = new KeyguardPresentation(mContext, display, mInjectableInflater);
presentation.setOnDismissListener(dialog -> {
if (null != mPresentations.get(displayId)) {
mPresentations.remove(displayId);
@@ -201,6 +207,7 @@
private final static class KeyguardPresentation extends Presentation {
private static final int VIDEO_SAFE_REGION = 80; // Percentage of display width & height
private static final int MOVE_CLOCK_TIMEOUT = 10000; // 10s
+ private final InjectionInflationController mInjectableInflater;
private View mClock;
private int mUsableWidth;
private int mUsableHeight;
@@ -217,8 +224,10 @@
}
};
- KeyguardPresentation(Context context, Display display) {
+ KeyguardPresentation(Context context, Display display,
+ InjectionInflationController injectionInflater) {
super(context, display, R.style.keyguard_presentation_theme);
+ mInjectableInflater = injectionInflater;
getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
setCancelable(false);
}
@@ -239,7 +248,9 @@
mMarginLeft = (100 - VIDEO_SAFE_REGION) * p.x / 200;
mMarginTop = (100 - VIDEO_SAFE_REGION) * p.y / 200;
- setContentView(R.layout.keyguard_presentation);
+ LayoutInflater inflater = mInjectableInflater.injectable(
+ LayoutInflater.from(getContext()));
+ setContentView(inflater.inflate(R.layout.keyguard_presentation, null));
mClock = findViewById(R.id.clock);
// Avoid screen burn in
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java
index 870ac87..32c1242 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java
@@ -141,6 +141,8 @@
@Override
public void onTimeTick() {
mAnalogClock.onTimeChanged();
+ mDigitalClock.refresh();
+ mLockClock.refresh();
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/StretchAnalogClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/StretchAnalogClockController.java
index 7401819..34b2fd8 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/StretchAnalogClockController.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/StretchAnalogClockController.java
@@ -136,6 +136,8 @@
@Override
public void onTimeTick() {
mAnalogClock.onTimeChanged();
+ mDigitalClock.refresh();
+ mLockClock.refresh();
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageProcessHelper.java b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageProcessHelper.java
index 477e7d7e..d1939d0 100644
--- a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageProcessHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageProcessHelper.java
@@ -85,7 +85,9 @@
Bitmap bitmap = bitmaps[0];
if (bitmap != null) {
int[] histogram = processHistogram(bitmap);
- return computePercentile85(bitmap, histogram);
+ Float val = computePercentile85(bitmap, histogram);
+ bitmaps[0] = null;
+ return val;
}
Log.e(TAG, "Per85ComputeTask: Can't get bitmap");
return DEFAULT_PER85;
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 676e594..d70d0d8 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -90,6 +90,7 @@
import com.android.systemui.statusbar.phone.NotificationPanelView;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
+import com.android.systemui.util.InjectionInflationController;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -710,7 +711,10 @@
mContext.registerReceiver(mDelayedLockBroadcastReceiver, delayedActionFilter,
SYSTEMUI_PERMISSION, null /* scheduler */);
- mKeyguardDisplayManager = new KeyguardDisplayManager(mContext);
+ InjectionInflationController injectionInflationController =
+ new InjectionInflationController(SystemUIFactory.getInstance().getRootComponent());
+ mKeyguardDisplayManager = new KeyguardDisplayManager(mContext,
+ injectionInflationController);
mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index 813faa9..520df97 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -36,6 +36,7 @@
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
+import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.PorterDuff;
@@ -58,6 +59,7 @@
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
+import android.view.ViewOutlineProvider;
import android.view.ViewTreeObserver;
import android.view.WindowInsets;
import android.view.accessibility.AccessibilityEvent;
@@ -394,6 +396,16 @@
}
}
};
+ private final ViewOutlineProvider mOutlineProvider = new ViewOutlineProvider() {
+ @Override
+ public void getOutline(View view, Outline outline) {
+ if (mAmbientState.isDarkAtAll() && !mAmbientState.isFullyDark()) {
+ outline.setRoundRect(mBackgroundAnimationRect, mCornerRadius);
+ } else {
+ ViewOutlineProvider.BACKGROUND.getOutline(view, outline);
+ }
+ }
+ };
private PorterDuffXfermode mSrcMode = new PorterDuffXfermode(PorterDuff.Mode.SRC);
private boolean mPulsing;
private boolean mGroupExpandedForMeasure;
@@ -520,6 +532,7 @@
mRoundnessManager.setAnimatedChildren(mChildrenToAddAnimated);
mRoundnessManager.setOnRoundingChangedCallback(this::invalidate);
addOnExpandedHeightListener(mRoundnessManager::setExpanded);
+ setOutlineProvider(mOutlineProvider);
// Blocking helper manager wants to know the expanded state, update as well.
NotificationBlockingHelperManager blockingHelperManager =
@@ -1298,6 +1311,7 @@
public void updateClipping() {
boolean clipped = mRequestedClipBounds != null && !mInHeadsUpPinnedMode
&& !mHeadsUpAnimatingAway;
+ boolean clipToOutline = false;
if (mIsClipped != clipped) {
mIsClipped = clipped;
}
@@ -1306,12 +1320,15 @@
&& mAmbientState.isFullyDark() && mShowDarkShelf) {
setClipBounds(null);
} else if (mAmbientState.isDarkAtAll()) {
- setClipBounds(mBackgroundAnimationRect);
+ clipToOutline = true;
+ invalidateOutline();
} else if (clipped) {
setClipBounds(mRequestedClipBounds);
} else {
setClipBounds(null);
}
+
+ setClipToOutline(clipToOutline);
}
/**
@@ -4805,6 +4822,9 @@
if (!wasDarkAtAll && nowDarkAtAll) {
resetExposedMenuView(true /* animate */, true /* animate */);
}
+ if (nowFullyDark != wasFullyDark || wasDarkAtAll != nowDarkAtAll) {
+ invalidateOutline();
+ }
updateAlgorithmHeightAndPadding();
updateBackgroundDimming();
updatePanelTranslation();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 253bdfb..b902e43 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -92,6 +92,7 @@
import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
import com.android.systemui.statusbar.policy.ZenModeController;
+import com.android.systemui.util.InjectionInflationController;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -141,6 +142,7 @@
private static final AnimationProperties CLOCK_ANIMATION_PROPERTIES = new AnimationProperties()
.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
+ private final InjectionInflationController mInjectionInflationController;
private final PowerManager mPowerManager;
private final AccessibilityManager mAccessibilityManager;
private final NotificationWakeUpCoordinator mWakeUpCoordinator;
@@ -336,10 +338,12 @@
@Inject
public NotificationPanelView(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
+ InjectionInflationController injectionInflationController,
NotificationWakeUpCoordinator coordinator,
PulseExpansionHandler pulseExpansionHandler) {
super(context, attrs);
setWillNotDraw(!DEBUG);
+ mInjectionInflationController = injectionInflationController;
mFalsingManager = FalsingManager.getInstance(context);
mPowerManager = context.getSystemService(PowerManager.class);
mWakeUpCoordinator = coordinator;
@@ -475,10 +479,11 @@
// Re-inflate the status view group.
int index = indexOfChild(mKeyguardStatusView);
removeView(mKeyguardStatusView);
- mKeyguardStatusView = (KeyguardStatusView) LayoutInflater.from(mContext).inflate(
- R.layout.keyguard_status_view,
- this,
- false);
+ mKeyguardStatusView = (KeyguardStatusView) mInjectionInflationController
+ .injectable(LayoutInflater.from(mContext)).inflate(
+ R.layout.keyguard_status_view,
+ this,
+ false);
addView(mKeyguardStatusView, index);
// Re-associate the clock container with the keyguard clock switch.
@@ -490,10 +495,11 @@
index = indexOfChild(mKeyguardBottomArea);
removeView(mKeyguardBottomArea);
KeyguardBottomAreaView oldBottomArea = mKeyguardBottomArea;
- mKeyguardBottomArea = (KeyguardBottomAreaView) LayoutInflater.from(mContext).inflate(
- R.layout.keyguard_bottom_area,
- this,
- false);
+ mKeyguardBottomArea = (KeyguardBottomAreaView) mInjectionInflationController
+ .injectable(LayoutInflater.from(mContext)).inflate(
+ R.layout.keyguard_bottom_area,
+ this,
+ false);
mKeyguardBottomArea.initFrom(oldBottomArea);
addView(mKeyguardBottomArea, index);
initBottomArea();
diff --git a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
index e6b6672..7705e4e 100644
--- a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
+++ b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
@@ -23,6 +23,7 @@
import android.view.LayoutInflater;
import android.view.View;
+import com.android.keyguard.KeyguardClockSwitch;
import com.android.systemui.SystemUIFactory;
import com.android.systemui.qs.QSCarrierGroup;
import com.android.systemui.qs.QSFooterImpl;
@@ -130,6 +131,11 @@
* Creates the QSCarrierGroup
*/
QSCarrierGroup createQSCarrierGroup();
+
+ /**
+ * Creates the KeyguardClockSwitch.
+ */
+ KeyguardClockSwitch createKeyguardClockSwitch();
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/volume/CaptionsToggleImageButton.java b/packages/SystemUI/src/com/android/systemui/volume/CaptionsToggleImageButton.java
new file mode 100644
index 0000000..8ec66e4
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/volume/CaptionsToggleImageButton.java
@@ -0,0 +1,67 @@
+/*
+ * 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 com.android.systemui.volume;
+
+import android.content.Context;
+import android.util.AttributeSet;
+
+import com.android.keyguard.AlphaOptimizedImageButton;
+import com.android.systemui.R;
+
+/** Toggle button in Volume Dialog that allows extra state for when streams are opted-out */
+public class CaptionsToggleImageButton extends AlphaOptimizedImageButton {
+
+ private static final int[] OPTED_OUT_STATE = new int[] { R.attr.optedOut };
+
+ private boolean mComponentEnabled = false;
+ private boolean mOptedOut = false;
+
+ public CaptionsToggleImageButton(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ public int[] onCreateDrawableState(int extraSpace) {
+ int[] state = super.onCreateDrawableState(extraSpace + 1);
+ if (mOptedOut) {
+ mergeDrawableStates(state, OPTED_OUT_STATE);
+ }
+ return state;
+ }
+
+ Runnable setComponentEnabled(boolean isComponentEnabled) {
+ this.mComponentEnabled = isComponentEnabled;
+
+ return this.setImageResourceAsync(this.mComponentEnabled
+ ? R.drawable.ic_volume_odi_captions
+ : R.drawable.ic_volume_odi_captions_disabled);
+ }
+
+ boolean getComponentEnabled() {
+ return this.mComponentEnabled;
+ }
+
+ /** Sets whether or not the current stream has opted out of captions */
+ void setOptedOut(boolean isOptedOut) {
+ this.mOptedOut = isOptedOut;
+ refreshDrawableState();
+ }
+
+ boolean getOptedOut() {
+ return this.mOptedOut;
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java
index 2fa8889..a3db533 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java
@@ -282,6 +282,13 @@
Settings.Secure.ODI_CAPTIONS_ENABLED, isEnabled ? 1 : 0);
}
+ @Override
+ public boolean isCaptionStreamOptedOut() {
+ int currentValue = Settings.Secure.getInt(mContext.getContentResolver(),
+ Settings.Secure.ODI_CAPTIONS_OPTED_OUT, 0);
+ return currentValue == 1;
+ }
+
public void getCaptionsComponentState(boolean fromTooltip) {
if (mDestroyed) return;
mWorker.obtainMessage(W.GET_CAPTIONS_COMPONENT_STATE, fromTooltip).sendToTarget();
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
index cdda216..bd7824d 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
@@ -133,7 +133,7 @@
private ViewGroup mRinger;
private ImageButton mRingerIcon;
private ViewGroup mODICaptionsView;
- private ImageButton mODICaptionsIcon;
+ private CaptionsToggleImageButton mODICaptionsIcon;
private View mSettingsView;
private ImageButton mSettingsIcon;
private FrameLayout mZenIcon;
@@ -587,11 +587,15 @@
}
private void updateCaptionsIcon() {
- mHandler.post(
- mODICaptionsIcon.setImageResourceAsync(
- mController.areCaptionsEnabled()
- ? R.drawable.ic_volume_odi_captions
- : R.drawable.ic_volume_odi_captions_disabled));
+ boolean componentEnabled = mController.areCaptionsEnabled();
+ if (mODICaptionsIcon.getComponentEnabled() != componentEnabled) {
+ mHandler.post(mODICaptionsIcon.setComponentEnabled(componentEnabled));
+ }
+
+ boolean isOptedOut = mController.isCaptionStreamOptedOut();
+ if (mODICaptionsIcon.getOptedOut() != isOptedOut) {
+ mHandler.post(() -> mODICaptionsIcon.setOptedOut(isOptedOut));
+ }
}
private void onCaptionIconClicked() {
@@ -952,7 +956,7 @@
}
private void updateVolumeRowH(VolumeRow row) {
- if (D.BUG) Log.d(TAG, "updateVolumeRowH s=" + row.stream);
+ if (D.BUG) Log.i(TAG, "updateVolumeRowH s=" + row.stream);
if (mState == null) return;
final StreamState ss = mState.states.get(row.stream);
if (ss == null) return;
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java
index 29505a2..632b0c0 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java
@@ -39,10 +39,12 @@
import android.widget.TextClock;
import com.android.keyguard.clock.ClockManager;
+import com.android.systemui.SystemUIFactory;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.plugins.ClockPlugin;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.StatusBarState;
+import com.android.systemui.util.InjectionInflationController;
import org.junit.Before;
import org.junit.Test;
@@ -70,7 +72,10 @@
@Before
public void setUp() {
- LayoutInflater layoutInflater = LayoutInflater.from(getContext());
+ InjectionInflationController inflationController = new InjectionInflationController(
+ SystemUIFactory.getInstance().getRootComponent());
+ LayoutInflater layoutInflater = inflationController
+ .injectable(LayoutInflater.from(getContext()));
mKeyguardClockSwitch =
(KeyguardClockSwitch) layoutInflater.inflate(R.layout.keyguard_clock_switch, null);
mClockContainer = mKeyguardClockSwitch.findViewById(R.id.clock_view);
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.java
index 3582ab01..31ea39c 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.java
@@ -24,8 +24,10 @@
import android.testing.TestableLooper.RunWithLooper;
import android.view.LayoutInflater;
+import com.android.systemui.SystemUIFactory;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.util.Assert;
+import com.android.systemui.util.InjectionInflationController;
import org.junit.Before;
import org.junit.Test;
@@ -48,7 +50,10 @@
@Before
public void setUp() {
Assert.sMainLooper = TestableLooper.get(this).getLooper();
- LayoutInflater layoutInflater = LayoutInflater.from(getContext());
+ InjectionInflationController inflationController = new InjectionInflationController(
+ SystemUIFactory.getInstance().getRootComponent());
+ LayoutInflater layoutInflater = inflationController
+ .injectable(LayoutInflater.from(getContext()));
mKeyguardStatusView =
(KeyguardStatusView) layoutInflater.inflate(R.layout.keyguard_status_view, null);
org.mockito.MockitoAnnotations.initMocks(this);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardPresentationTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardPresentationTest.java
index eec836f..dfe2913 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardPresentationTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardPresentationTest.java
@@ -23,7 +23,9 @@
import androidx.test.filters.SmallTest;
import com.android.systemui.R;
+import com.android.systemui.SystemUIFactory;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.util.InjectionInflationController;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -35,7 +37,10 @@
@Test
public void testInflation_doesntCrash() {
com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
- LayoutInflater inflater = LayoutInflater.from(getContext());
+ InjectionInflationController inflationController = new InjectionInflationController(
+ SystemUIFactory.getInstance().getRootComponent());
+ LayoutInflater inflater = inflationController
+ .injectable(LayoutInflater.from(getContext()));
inflater.inflate(R.layout.keyguard_presentation, null);
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
index 6889c57..232c6a2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
@@ -27,6 +27,7 @@
import androidx.test.filters.SmallTest;
import com.android.keyguard.KeyguardStatusView;
+import com.android.systemui.SystemUIFactory;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.AmbientPulseManager;
@@ -38,6 +39,7 @@
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ZenModeController;
+import com.android.systemui.util.InjectionInflationController;
import org.junit.Before;
import org.junit.Test;
@@ -104,7 +106,10 @@
private class TestableNotificationPanelView extends NotificationPanelView {
TestableNotificationPanelView(NotificationWakeUpCoordinator coordinator,
PulseExpansionHandler expansionHandler) {
- super(NotificationPanelViewTest.this.mContext, null, coordinator, expansionHandler);
+ super(NotificationPanelViewTest.this.mContext, null,
+ new InjectionInflationController(
+ SystemUIFactory.getInstance().getRootComponent()),
+ coordinator, expansionHandler);
mNotificationStackScroller = mNotificationStackScrollLayout;
mKeyguardStatusView = NotificationPanelViewTest.this.mKeyguardStatusView;
mKeyguardStatusBar = NotificationPanelViewTest.this.mKeyguardStatusBar;
diff --git a/packages/overlays/Android.mk b/packages/overlays/Android.mk
index a15e89c..b522344 100644
--- a/packages/overlays/Android.mk
+++ b/packages/overlays/Android.mk
@@ -39,7 +39,10 @@
IconShapeRoundedRectOverlay \
IconShapeSquareOverlay \
IconShapeSquircleOverlay \
- IconShapeTeardropOverlay
+ IconShapeTeardropOverlay \
+ NavigationBarMode3ButtonOverlay \
+ NavigationBarMode2ButtonOverlay \
+ NavigationBarModeGesturalOverlay
include $(BUILD_PHONY_PACKAGE)
include $(CLEAR_VARS)
diff --git a/packages/overlays/NavigationBarMode2ButtonOverlay/Android.mk b/packages/overlays/NavigationBarMode2ButtonOverlay/Android.mk
new file mode 100644
index 0000000..410d6d8
--- /dev/null
+++ b/packages/overlays/NavigationBarMode2ButtonOverlay/Android.mk
@@ -0,0 +1,30 @@
+#
+# Copyright 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_RRO_THEME := NavigationBarMode2Button
+LOCAL_CERTIFICATE := platform
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+
+LOCAL_PACKAGE_NAME := NavigationBarMode2ButtonOverlay
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_RRO_PACKAGE)
\ No newline at end of file
diff --git a/packages/overlays/NavigationBarMode2ButtonOverlay/AndroidManifest.xml b/packages/overlays/NavigationBarMode2ButtonOverlay/AndroidManifest.xml
new file mode 100644
index 0000000..970380f
--- /dev/null
+++ b/packages/overlays/NavigationBarMode2ButtonOverlay/AndroidManifest.xml
@@ -0,0 +1,27 @@
+<!--
+/**
+ * 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.
+ */
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.internal.systemui.navbar.twobutton"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <overlay android:targetPackage="android"
+ android:category="com.android.internal.navigation_bar_mode"
+ android:priority="1"/>
+
+ <application android:label="@string/navigation_bar_mode_title" android:hasCode="false"/>
+</manifest>
\ No newline at end of file
diff --git a/packages/overlays/NavigationBarMode2ButtonOverlay/res/values/config.xml b/packages/overlays/NavigationBarMode2ButtonOverlay/res/values/config.xml
new file mode 100644
index 0000000..b353322
--- /dev/null
+++ b/packages/overlays/NavigationBarMode2ButtonOverlay/res/values/config.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<resources>
+ <!-- Controls the navigation bar interaction mode:
+ 0: 3 button mode (back, home, overview buttons)
+ 1: 2 button mode (back, home buttons + swipe up for overview)
+ 2: gestures only for back, home and overview -->
+ <integer name="config_navBarInteractionMode">1</integer>
+</resources>
\ No newline at end of file
diff --git a/packages/overlays/NavigationBarMode2ButtonOverlay/res/values/strings.xml b/packages/overlays/NavigationBarMode2ButtonOverlay/res/values/strings.xml
new file mode 100644
index 0000000..1696ecf
--- /dev/null
+++ b/packages/overlays/NavigationBarMode2ButtonOverlay/res/values/strings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Name of overlay [CHAR LIMIT=64] -->
+ <string name="navigation_bar_mode_title" translatable="false">2 Button Navigation Bar</string>
+</resources>
\ No newline at end of file
diff --git a/packages/overlays/NavigationBarMode3ButtonOverlay/Android.mk b/packages/overlays/NavigationBarMode3ButtonOverlay/Android.mk
new file mode 100644
index 0000000..2bc9a6a
--- /dev/null
+++ b/packages/overlays/NavigationBarMode3ButtonOverlay/Android.mk
@@ -0,0 +1,30 @@
+#
+# Copyright 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_RRO_THEME := NavigationBarMode3Button
+LOCAL_CERTIFICATE := platform
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+
+LOCAL_PACKAGE_NAME := NavigationBarMode3ButtonOverlay
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_RRO_PACKAGE)
\ No newline at end of file
diff --git a/packages/overlays/NavigationBarMode3ButtonOverlay/AndroidManifest.xml b/packages/overlays/NavigationBarMode3ButtonOverlay/AndroidManifest.xml
new file mode 100644
index 0000000..628fc1d
--- /dev/null
+++ b/packages/overlays/NavigationBarMode3ButtonOverlay/AndroidManifest.xml
@@ -0,0 +1,27 @@
+<!--
+/**
+ * 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.
+ */
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.internal.systemui.navbar.threebutton"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <overlay android:targetPackage="android"
+ android:category="com.android.internal.navigation_bar_mode"
+ android:priority="1"/>
+
+ <application android:label="@string/navigation_bar_mode_title" android:hasCode="false"/>
+</manifest>
\ No newline at end of file
diff --git a/packages/overlays/NavigationBarMode3ButtonOverlay/res/values/config.xml b/packages/overlays/NavigationBarMode3ButtonOverlay/res/values/config.xml
new file mode 100644
index 0000000..7bd0a14
--- /dev/null
+++ b/packages/overlays/NavigationBarMode3ButtonOverlay/res/values/config.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<resources>
+ <!-- Controls the navigation bar interaction mode:
+ 0: 3 button mode (back, home, overview buttons)
+ 1: 2 button mode (back, home buttons + swipe up for overview)
+ 2: gestures only for back, home and overview -->
+ <integer name="config_navBarInteractionMode">0</integer>
+</resources>
\ No newline at end of file
diff --git a/packages/overlays/NavigationBarMode3ButtonOverlay/res/values/strings.xml b/packages/overlays/NavigationBarMode3ButtonOverlay/res/values/strings.xml
new file mode 100644
index 0000000..201b9e9
--- /dev/null
+++ b/packages/overlays/NavigationBarMode3ButtonOverlay/res/values/strings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Name of overlay [CHAR LIMIT=64] -->
+ <string name="navigation_bar_mode_title" translatable="false">3 Button Navigation Bar</string>
+</resources>
\ No newline at end of file
diff --git a/packages/overlays/NavigationBarModeGesturalOverlay/Android.mk b/packages/overlays/NavigationBarModeGesturalOverlay/Android.mk
new file mode 100644
index 0000000..5f7e0eb
--- /dev/null
+++ b/packages/overlays/NavigationBarModeGesturalOverlay/Android.mk
@@ -0,0 +1,30 @@
+#
+# Copyright 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_RRO_THEME := NavigationBarModeGestural
+LOCAL_CERTIFICATE := platform
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+
+LOCAL_PACKAGE_NAME := NavigationBarModeGesturalOverlay
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_RRO_PACKAGE)
\ No newline at end of file
diff --git a/packages/overlays/NavigationBarModeGesturalOverlay/AndroidManifest.xml b/packages/overlays/NavigationBarModeGesturalOverlay/AndroidManifest.xml
new file mode 100644
index 0000000..aff82d8
--- /dev/null
+++ b/packages/overlays/NavigationBarModeGesturalOverlay/AndroidManifest.xml
@@ -0,0 +1,27 @@
+<!--
+/**
+ * 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.
+ */
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.internal.systemui.navbar.gestural"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <overlay android:targetPackage="android"
+ android:category="com.android.internal.navigation_bar_mode"
+ android:priority="1"/>
+
+ <application android:label="@string/navigation_bar_mode_title" android:hasCode="false"/>
+</manifest>
\ No newline at end of file
diff --git a/packages/overlays/NavigationBarModeGesturalOverlay/res/values/config.xml b/packages/overlays/NavigationBarModeGesturalOverlay/res/values/config.xml
new file mode 100644
index 0000000..48c3769
--- /dev/null
+++ b/packages/overlays/NavigationBarModeGesturalOverlay/res/values/config.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<resources>
+ <!-- Controls the navigation bar interaction mode:
+ 0: 3 button mode (back, home, overview buttons)
+ 1: 2 button mode (back, home buttons + swipe up for overview)
+ 2: gestures only for back, home and overview -->
+ <integer name="config_navBarInteractionMode">2</integer>
+</resources>
\ No newline at end of file
diff --git a/packages/overlays/NavigationBarModeGesturalOverlay/res/values/strings.xml b/packages/overlays/NavigationBarModeGesturalOverlay/res/values/strings.xml
new file mode 100644
index 0000000..8d38916
--- /dev/null
+++ b/packages/overlays/NavigationBarModeGesturalOverlay/res/values/strings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Name of overlay [CHAR LIMIT=64] -->
+ <string name="navigation_bar_mode_title" translatable="false">Gestural Navigation Bar</string>
+</resources>
\ No newline at end of file
diff --git a/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java b/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java
index 9995d8e..3619a9d 100644
--- a/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java
+++ b/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java
@@ -18,6 +18,12 @@
import static android.Manifest.permission.MANAGE_CONTENT_CAPTURE;
import static android.content.Context.CONTENT_CAPTURE_MANAGER_SERVICE;
+import static android.view.contentcapture.ContentCaptureManager.RESULT_CODE_FALSE;
+import static android.view.contentcapture.ContentCaptureManager.RESULT_CODE_OK;
+import static android.view.contentcapture.ContentCaptureManager.RESULT_CODE_SECURITY_EXCEPTION;
+import static android.view.contentcapture.ContentCaptureManager.RESULT_CODE_TRUE;
+
+import static com.android.internal.util.SyncResultReceiver.bundleFor;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -57,7 +63,6 @@
import com.android.internal.os.IResultReceiver;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.Preconditions;
-import com.android.internal.util.SyncResultReceiver;
import com.android.server.LocalServices;
import com.android.server.infra.AbstractMasterSystemService;
import com.android.server.infra.FrameworkResourcesServiceNameResolver;
@@ -414,8 +419,7 @@
if (isService) return true;
try {
- result.send(ContentCaptureManager.RESULT_CODE_NOT_SERVICE,
- /* resultData= */ null);
+ result.send(RESULT_CODE_SECURITY_EXCEPTION, /* resultData= */ null);
} catch (RemoteException e) {
Slog.w(mTag, "Unable to send isContentCaptureFeatureEnabled(): " + e);
}
@@ -518,8 +522,7 @@
connectedServiceComponentName = service.getServiceComponentName();
}
try {
- result.send(/* resultCode= */ 0,
- SyncResultReceiver.bundleFor(connectedServiceComponentName));
+ result.send(RESULT_CODE_OK, bundleFor(connectedServiceComponentName));
} catch (RemoteException e) {
Slog.w(mTag, "Unable to send service component name: " + e);
}
@@ -547,14 +550,40 @@
enabled = !mDisabledByDeviceConfig && !isDisabledBySettingsLocked(userId);
}
try {
- result.send(enabled ? ContentCaptureManager.RESULT_CODE_TRUE
- : ContentCaptureManager.RESULT_CODE_FALSE, /* resultData= */null);
+ result.send(enabled ? RESULT_CODE_TRUE : RESULT_CODE_FALSE, /* resultData= */null);
} catch (RemoteException e) {
Slog.w(mTag, "Unable to send isContentCaptureFeatureEnabled(): " + e);
}
}
@Override
+ public void getServiceSettingsActivity(@NonNull IResultReceiver result) {
+ try {
+ enforceCallingPermissionForManagement();
+ } catch (SecurityException e) {
+ try {
+ result.send(RESULT_CODE_SECURITY_EXCEPTION, bundleFor(e.getMessage()));
+ } catch (RemoteException e2) {
+ Slog.w(mTag, "Unable to send getServiceSettingsIntent() exception: " + e2);
+ return;
+ }
+ }
+
+ final int userId = UserHandle.getCallingUserId();
+ final ComponentName componentName;
+ synchronized (mLock) {
+ final ContentCapturePerUserService service = getServiceForUserLocked(userId);
+ if (service == null) return;
+ componentName = service.getServiceSettingsActivityLocked();
+ }
+ try {
+ result.send(RESULT_CODE_OK, bundleFor(componentName));
+ } catch (RemoteException e) {
+ Slog.w(mTag, "Unable to send getServiceSettingsIntent(): " + e);
+ }
+ }
+
+ @Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (!DumpUtils.checkDumpPermission(getContext(), mTag, pw)) return;
diff --git a/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java b/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
index d7d97b3..955f260 100644
--- a/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
+++ b/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
@@ -332,6 +332,18 @@
mRemoteService.onUserDataRemovalRequest(request);
}
+ @GuardedBy("mLock")
+ @Nullable
+ public ComponentName getServiceSettingsActivityLocked() {
+ if (mInfo == null) return null;
+
+ final String activityName = mInfo.getSettingsActivity();
+ if (activityName == null) return null;
+
+ final String packageName = mInfo.getServiceInfo().packageName;
+ return new ComponentName(packageName, activityName);
+ }
+
/**
* Asserts the component is owned by the caller.
*/
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java
index b89223b..f0244c3 100644
--- a/services/core/java/com/android/server/LocationManagerService.java
+++ b/services/core/java/com/android/server/LocationManagerService.java
@@ -3597,10 +3597,18 @@
pw.println(" " + provider + ": " + location);
}
- mGeofenceManager.dump(pw);
-
- pw.append(" ");
- mBlacklist.dump(pw);
+ if (mGeofenceManager != null) {
+ mGeofenceManager.dump(pw);
+ } else {
+ pw.println(" Geofences: null");
+ }
+
+ if (mBlacklist != null) {
+ pw.append(" ");
+ mBlacklist.dump(pw);
+ } else {
+ pw.println(" mBlacklist=null");
+ }
if (mLocationControllerExtraPackage != null) {
pw.println(" Location controller extra package: " + mLocationControllerExtraPackage
@@ -3614,8 +3622,12 @@
}
}
- pw.append(" fudger: ");
- mLocationFudger.dump(fd, pw, args);
+ if (mLocationFudger != null) {
+ pw.append(" fudger: ");
+ mLocationFudger.dump(fd, pw, args);
+ } else {
+ pw.println(" fudger: null");
+ }
if (args.length > 0 && "short".equals(args[0])) {
return;
diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java
index 10b67c1..2e5dd3b 100644
--- a/services/core/java/com/android/server/appop/AppOpsService.java
+++ b/services/core/java/com/android/server/appop/AppOpsService.java
@@ -1257,6 +1257,7 @@
}
scheduleWriteLocked();
}
+ uidState.evalForegroundOps(mOpModeWatchers);
}
String[] uidPackageNames = getPackagesForUid(uid);
@@ -2414,8 +2415,6 @@
private void commitUidPendingStateLocked(UidState uidState) {
final boolean lastForeground = uidState.state <= UID_STATE_MAX_LAST_NON_RESTRICTED;
final boolean nowForeground = uidState.pendingState <= UID_STATE_MAX_LAST_NON_RESTRICTED;
- uidState.state = uidState.pendingState;
- uidState.pendingStateCommitTime = 0;
if (uidState.hasForegroundWatchers && lastForeground != nowForeground) {
for (int fgi = uidState.foregroundOps.size() - 1; fgi >= 0; fgi--) {
if (!uidState.foregroundOps.valueAt(fgi)) {
@@ -2424,11 +2423,10 @@
final int code = uidState.foregroundOps.keyAt(fgi);
// For location ops we consider fg state only if the fg service
// is of location type, for all other ops any fg service will do.
- final long resolvedLastRestrictedUidState = resolveFirstUnrestrictedUidState(code);
- final boolean resolvedLastFg = uidState.state <= resolvedLastRestrictedUidState;
- final boolean resolvedNowBg = uidState.pendingState
- <= resolvedLastRestrictedUidState;
- if (resolvedLastFg == resolvedNowBg) {
+ final long firstUnrestrictedUidState = resolveFirstUnrestrictedUidState(code);
+ final boolean resolvedLastFg = uidState.state <= firstUnrestrictedUidState;
+ final boolean resolvedNowFg = uidState.pendingState <= firstUnrestrictedUidState;
+ if (resolvedLastFg == resolvedNowFg) {
continue;
}
final ArraySet<ModeCallback> callbacks = mOpModeWatchers.get(code);
@@ -2460,6 +2458,8 @@
}
}
}
+ uidState.state = uidState.pendingState;
+ uidState.pendingStateCommitTime = 0;
}
private Ops getOpsRawLocked(int uid, String packageName, boolean edit,
diff --git a/services/core/java/com/android/server/broadcastradio/BroadcastRadioService.java b/services/core/java/com/android/server/broadcastradio/BroadcastRadioService.java
index 4289a25..54a4ad4 100644
--- a/services/core/java/com/android/server/broadcastradio/BroadcastRadioService.java
+++ b/services/core/java/com/android/server/broadcastradio/BroadcastRadioService.java
@@ -16,7 +16,6 @@
package com.android.server.broadcastradio;
-import android.annotation.NonNull;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -26,14 +25,13 @@
import android.hardware.radio.ITuner;
import android.hardware.radio.ITunerCallback;
import android.hardware.radio.RadioManager;
-import android.os.ParcelableException;
import android.os.RemoteException;
import android.util.Slog;
-import com.android.internal.util.Preconditions;
import com.android.server.SystemService;
import com.android.server.broadcastradio.hal2.AnnouncementAggregator;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
@@ -45,16 +43,20 @@
private final ServiceImpl mServiceImpl = new ServiceImpl();
- private final com.android.server.broadcastradio.hal1.BroadcastRadioService mHal1 =
- new com.android.server.broadcastradio.hal1.BroadcastRadioService();
- private final com.android.server.broadcastradio.hal2.BroadcastRadioService mHal2 =
- new com.android.server.broadcastradio.hal2.BroadcastRadioService();
+ private final com.android.server.broadcastradio.hal1.BroadcastRadioService mHal1;
+ private final com.android.server.broadcastradio.hal2.BroadcastRadioService mHal2;
private final Object mLock = new Object();
- private List<RadioManager.ModuleProperties> mModules = null;
+ private List<RadioManager.ModuleProperties> mV1Modules = null;
public BroadcastRadioService(Context context) {
super(context);
+
+ mHal1 = new com.android.server.broadcastradio.hal1.BroadcastRadioService();
+ mV1Modules = mHal1.loadModules();
+ OptionalInt max = mV1Modules.stream().mapToInt(RadioManager.ModuleProperties::getId).max();
+ mHal2 = new com.android.server.broadcastradio.hal2.BroadcastRadioService(
+ max.isPresent() ? max.getAsInt() + 1 : 0);
}
@Override
@@ -62,14 +64,6 @@
publishBinderService(Context.RADIO_SERVICE, mServiceImpl);
}
- /**
- * Finds next available index for newly loaded modules.
- */
- private static int getNextId(@NonNull List<RadioManager.ModuleProperties> modules) {
- OptionalInt max = modules.stream().mapToInt(RadioManager.ModuleProperties::getId).max();
- return max.isPresent() ? max.getAsInt() + 1 : 0;
- }
-
private class ServiceImpl extends IRadioService.Stub {
private void enforcePolicyAccess() {
if (PackageManager.PERMISSION_GRANTED != getContext().checkCallingPermission(
@@ -81,14 +75,10 @@
@Override
public List<RadioManager.ModuleProperties> listModules() {
enforcePolicyAccess();
- synchronized (mLock) {
- if (mModules != null) return mModules;
-
- mModules = mHal1.loadModules();
- mModules.addAll(mHal2.loadModules(getNextId(mModules)));
-
- return mModules;
- }
+ List<RadioManager.ModuleProperties> modules = new ArrayList<>();
+ modules.addAll(mV1Modules);
+ modules.addAll(mHal2.listModules());
+ return modules;
}
@Override
diff --git a/services/core/java/com/android/server/broadcastradio/hal2/BroadcastRadioService.java b/services/core/java/com/android/server/broadcastradio/hal2/BroadcastRadioService.java
index 954c001..b8810c8f 100644
--- a/services/core/java/com/android/server/broadcastradio/hal2/BroadcastRadioService.java
+++ b/services/core/java/com/android/server/broadcastradio/hal2/BroadcastRadioService.java
@@ -18,20 +18,22 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.hardware.broadcastradio.V2_0.IBroadcastRadio;
import android.hardware.radio.IAnnouncementListener;
import android.hardware.radio.ICloseHandle;
import android.hardware.radio.ITuner;
import android.hardware.radio.ITunerCallback;
import android.hardware.radio.RadioManager;
-import android.hardware.broadcastradio.V2_0.IBroadcastRadio;
import android.hidl.manager.V1_0.IServiceManager;
+import android.hidl.manager.V1_0.IServiceNotification;
+import android.os.IHwBinder.DeathRecipient;
import android.os.RemoteException;
import android.util.Slog;
+import com.android.internal.annotations.GuardedBy;
+
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -39,52 +41,104 @@
public class BroadcastRadioService {
private static final String TAG = "BcRadio2Srv";
+ private final Object mLock = new Object();
+
+ @GuardedBy("mLock")
+ private int mNextModuleId = 0;
+
+ @GuardedBy("mLock")
+ private final Map<String, Integer> mServiceNameToModuleIdMap = new HashMap<>();
+
+ @GuardedBy("mLock")
private final Map<Integer, RadioModule> mModules = new HashMap<>();
- private static @NonNull List<String> listByInterface(@NonNull String fqName) {
+ private IServiceNotification.Stub mServiceListener = new IServiceNotification.Stub() {
+ @Override
+ public void onRegistration(String fqName, String serviceName, boolean preexisting) {
+ Slog.v(TAG, "onRegistration(" + fqName + ", " + serviceName + ", " + preexisting + ")");
+ Integer moduleId;
+ synchronized (mLock) {
+ // If the service has been registered before, reuse its previous module ID.
+ moduleId = mServiceNameToModuleIdMap.get(serviceName);
+ boolean newService = false;
+ if (moduleId == null) {
+ newService = true;
+ moduleId = mNextModuleId;
+ }
+
+ RadioModule module = RadioModule.tryLoadingModule(moduleId, serviceName);
+ if (module == null) {
+ return;
+ }
+ Slog.v(TAG, "loaded broadcast radio module " + moduleId + ": " + serviceName
+ + " (HAL 2.0)");
+ mModules.put(moduleId, module);
+
+ if (newService) {
+ mServiceNameToModuleIdMap.put(serviceName, moduleId);
+ mNextModuleId++;
+ }
+
+ try {
+ module.getService().linkToDeath(mDeathRecipient, moduleId);
+ } catch (RemoteException ex) {
+ // Service has already died, so remove its entry from mModules.
+ mModules.remove(moduleId);
+ }
+ }
+ }
+ };
+
+ private DeathRecipient mDeathRecipient = new DeathRecipient() {
+ @Override
+ public void serviceDied(long cookie) {
+ Slog.v(TAG, "serviceDied(" + cookie + ")");
+ synchronized (mLock) {
+ int moduleId = (int) cookie;
+ mModules.remove(moduleId);
+
+ for (Map.Entry<String, Integer> entry : mServiceNameToModuleIdMap.entrySet()) {
+ if (entry.getValue() == moduleId) {
+ Slog.i(TAG, "service " + entry.getKey()
+ + " died; removed RadioModule with ID " + moduleId);
+ return;
+ }
+ }
+ }
+ }
+ };
+
+ public BroadcastRadioService(int nextModuleId) {
+ mNextModuleId = nextModuleId;
try {
IServiceManager manager = IServiceManager.getService();
if (manager == null) {
- Slog.e(TAG, "Failed to get HIDL Service Manager");
- return Collections.emptyList();
+ Slog.e(TAG, "failed to get HIDL Service Manager");
+ return;
}
-
- List<String> list = manager.listByInterface(fqName);
- if (list == null) {
- Slog.e(TAG, "Didn't get interface list from HIDL Service Manager");
- return Collections.emptyList();
- }
- return list;
+ manager.registerForNotifications(IBroadcastRadio.kInterfaceName, "", mServiceListener);
} catch (RemoteException ex) {
- Slog.e(TAG, "Failed fetching interface list", ex);
- return Collections.emptyList();
+ Slog.e(TAG, "failed to register for service notifications: ", ex);
}
}
- public @NonNull Collection<RadioManager.ModuleProperties> loadModules(int idx) {
- Slog.v(TAG, "loadModules(" + idx + ")");
-
- for (String serviceName : listByInterface(IBroadcastRadio.kInterfaceName)) {
- Slog.v(TAG, "checking service: " + serviceName);
-
- RadioModule module = RadioModule.tryLoadingModule(idx, serviceName);
- if (module != null) {
- Slog.i(TAG, "loaded broadcast radio module " + idx + ": " +
- serviceName + " (HAL 2.0)");
- mModules.put(idx++, module);
- }
+ public @NonNull Collection<RadioManager.ModuleProperties> listModules() {
+ synchronized (mLock) {
+ return mModules.values().stream().map(module -> module.mProperties)
+ .collect(Collectors.toList());
}
-
- return mModules.values().stream().map(module -> module.mProperties).
- collect(Collectors.toList());
}
public boolean hasModule(int id) {
- return mModules.containsKey(id);
+ synchronized (mLock) {
+ return mModules.containsKey(id);
+ }
}
public boolean hasAnyModules() {
- return !mModules.isEmpty();
+ synchronized (mLock) {
+ return !mModules.isEmpty();
+ }
}
public ITuner openSession(int moduleId, @Nullable RadioManager.BandConfig legacyConfig,
@@ -95,7 +149,10 @@
throw new IllegalArgumentException("Non-audio sessions not supported with HAL 2.x");
}
- RadioModule module = mModules.get(moduleId);
+ RadioModule module = null;
+ synchronized (mLock) {
+ module = mModules.get(moduleId);
+ }
if (module == null) {
throw new IllegalArgumentException("Invalid module ID");
}
@@ -111,12 +168,14 @@
@NonNull IAnnouncementListener listener) {
AnnouncementAggregator aggregator = new AnnouncementAggregator(listener);
boolean anySupported = false;
- for (RadioModule module : mModules.values()) {
- try {
- aggregator.watchModule(module, enabledTypes);
- anySupported = true;
- } catch (UnsupportedOperationException ex) {
- Slog.v(TAG, "Announcements not supported for this module", ex);
+ synchronized (mLock) {
+ for (RadioModule module : mModules.values()) {
+ try {
+ aggregator.watchModule(module, enabledTypes);
+ anySupported = true;
+ } catch (UnsupportedOperationException ex) {
+ Slog.v(TAG, "Announcements not supported for this module", ex);
+ }
}
}
if (!anySupported) {
diff --git a/services/core/java/com/android/server/broadcastradio/hal2/RadioModule.java b/services/core/java/com/android/server/broadcastradio/hal2/RadioModule.java
index 816ba0b..832f8e1 100644
--- a/services/core/java/com/android/server/broadcastradio/hal2/RadioModule.java
+++ b/services/core/java/com/android/server/broadcastradio/hal2/RadioModule.java
@@ -20,8 +20,6 @@
import android.annotation.Nullable;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
-import android.hardware.radio.ITuner;
-import android.hardware.radio.RadioManager;
import android.hardware.broadcastradio.V2_0.AmFmRegionConfig;
import android.hardware.broadcastradio.V2_0.Announcement;
import android.hardware.broadcastradio.V2_0.DabTableEntry;
@@ -30,13 +28,12 @@
import android.hardware.broadcastradio.V2_0.ICloseHandle;
import android.hardware.broadcastradio.V2_0.ITunerSession;
import android.hardware.broadcastradio.V2_0.Result;
-import android.os.ParcelableException;
+import android.hardware.radio.RadioManager;
import android.os.RemoteException;
import android.util.MutableInt;
import android.util.Slog;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -78,6 +75,10 @@
}
}
+ public @NonNull IBroadcastRadio getService() {
+ return mService;
+ }
+
public @NonNull TunerSession openSession(@NonNull android.hardware.radio.ITunerCallback userCb)
throws RemoteException {
TunerCallback cb = new TunerCallback(Objects.requireNonNull(userCb));
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java
index 32f34b8..3010324 100644
--- a/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/services/core/java/com/android/server/display/DisplayManagerService.java
@@ -37,7 +37,6 @@
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.ColorSpace;
-import android.graphics.GraphicBuffer;
import android.graphics.Point;
import android.graphics.Rect;
import android.hardware.SensorManager;
@@ -1275,11 +1274,12 @@
if (token == null) {
return false;
}
- final GraphicBuffer gb = SurfaceControl.screenshotToBufferWithSecureLayersUnsafe(
- token, new Rect(), 0 /* width */, 0 /* height */, false /* useIdentityTransform */,
- 0 /* rotation */);
+ final SurfaceControl.ScreenshotGraphicBuffer gb =
+ SurfaceControl.screenshotToBufferWithSecureLayersUnsafe(
+ token, new Rect(), 0 /* width */, 0 /* height */,
+ false /* useIdentityTransform */, 0 /* rotation */);
try {
- outSurface.attachAndQueueBuffer(gb);
+ outSurface.attachAndQueueBuffer(gb.getGraphicBuffer());
} catch (RuntimeException e) {
Slog.w(TAG, "Failed to take screenshot - " + e.getMessage());
}
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index ca3c826..e43fc1f 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -4106,9 +4106,11 @@
if (r == null) {
return;
}
- if (adjustment.getSignals() != null) {
- Bundle.setDefusable(adjustment.getSignals(), true);
- r.addAdjustment(adjustment);
+ if (mAssistants.isAdjustmentAllowed(adjustment.getKey())) {
+ if (adjustment.getSignals() != null) {
+ Bundle.setDefusable(adjustment.getSignals(), true);
+ r.addAdjustment(adjustment);
+ }
}
}
@@ -7313,6 +7315,12 @@
}
}
+ protected boolean isAdjustmentAllowed(String type) {
+ synchronized (mLock) {
+ return mAllowedAdjustments.contains(type);
+ }
+ }
+
protected void onNotificationsSeenLocked(ArrayList<NotificationRecord> records) {
// There should be only one, but it's a list, so while we enforce
// singularity elsewhere, we keep it general here, to avoid surprises.
diff --git a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java
index b0d2704..15ed063 100644
--- a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java
+++ b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java
@@ -83,6 +83,9 @@
if (!Objects.equals(theTruth.overlayTarget, oldSettings.targetPackageName)) {
return true;
}
+ if (!Objects.equals(theTruth.targetOverlayableName, oldSettings.targetOverlayableName)) {
+ return true;
+ }
if (theTruth.isStaticOverlayPackage() != oldSettings.isStatic) {
return true;
}
@@ -149,6 +152,7 @@
mSettings.init(overlayPackage.packageName, newUserId,
overlayPackage.overlayTarget,
+ overlayPackage.targetOverlayableName,
overlayPackage.applicationInfo.getBaseCodePath(),
overlayPackage.isStaticOverlayPackage(),
overlayPackage.overlayPriority,
@@ -331,6 +335,7 @@
}
mSettings.init(packageName, userId, overlayPackage.overlayTarget,
+ overlayPackage.targetOverlayableName,
overlayPackage.applicationInfo.getBaseCodePath(),
overlayPackage.isStaticOverlayPackage(), overlayPackage.overlayPriority,
overlayPackage.overlayCategory);
@@ -395,7 +400,7 @@
if (oldOi != null && !oldOi.targetPackageName.equals(pkg.overlayTarget)) {
mListener.onOverlaysChanged(pkg.overlayTarget, userId);
}
- mSettings.init(packageName, userId, pkg.overlayTarget,
+ mSettings.init(packageName, userId, pkg.overlayTarget, pkg.targetOverlayableName,
pkg.applicationInfo.getBaseCodePath(), pkg.isStaticOverlayPackage(),
pkg.overlayPriority, pkg.overlayCategory);
}
diff --git a/services/core/java/com/android/server/om/OverlayManagerSettings.java b/services/core/java/com/android/server/om/OverlayManagerSettings.java
index 2b4ec03..667dfa1 100644
--- a/services/core/java/com/android/server/om/OverlayManagerSettings.java
+++ b/services/core/java/com/android/server/om/OverlayManagerSettings.java
@@ -65,12 +65,13 @@
private final ArrayList<SettingsItem> mItems = new ArrayList<>();
void init(@NonNull final String packageName, final int userId,
- @NonNull final String targetPackageName, @NonNull final String baseCodePath,
- boolean isStatic, int priority, String overlayCategory) {
+ @NonNull final String targetPackageName, @Nullable final String targetOverlayableName,
+ @NonNull final String baseCodePath, boolean isStatic, int priority,
+ @Nullable String overlayCategory) {
remove(packageName, userId);
final SettingsItem item =
- new SettingsItem(packageName, userId, targetPackageName, baseCodePath,
- isStatic, priority, overlayCategory);
+ new SettingsItem(packageName, userId, targetPackageName, targetOverlayableName,
+ baseCodePath, isStatic, priority, overlayCategory);
if (isStatic) {
// All static overlays are always enabled.
item.setEnabled(true);
@@ -302,16 +303,17 @@
pw.println(item.mPackageName + ":" + item.getUserId() + " {");
pw.increaseIndent();
- pw.println("mPackageName.......: " + item.mPackageName);
- pw.println("mUserId............: " + item.getUserId());
- pw.println("mTargetPackageName.: " + item.getTargetPackageName());
- pw.println("mBaseCodePath......: " + item.getBaseCodePath());
- pw.println("mState.............: " + OverlayInfo.stateToString(item.getState()));
- pw.println("mState.............: " + OverlayInfo.stateToString(item.getState()));
- pw.println("mIsEnabled.........: " + item.isEnabled());
- pw.println("mIsStatic..........: " + item.isStatic());
- pw.println("mPriority..........: " + item.mPriority);
- pw.println("mCategory..........: " + item.mCategory);
+ pw.println("mPackageName...........: " + item.mPackageName);
+ pw.println("mUserId................: " + item.getUserId());
+ pw.println("mTargetPackageName.....: " + item.getTargetPackageName());
+ pw.println("mTargetOverlayableName.: " + item.getTargetOverlayableName());
+ pw.println("mBaseCodePath..........: " + item.getBaseCodePath());
+ pw.println("mState.................: " + OverlayInfo.stateToString(item.getState()));
+ pw.println("mState.................: " + OverlayInfo.stateToString(item.getState()));
+ pw.println("mIsEnabled.............: " + item.isEnabled());
+ pw.println("mIsStatic..............: " + item.isStatic());
+ pw.println("mPriority..............: " + item.mPriority);
+ pw.println("mCategory..............: " + item.mCategory);
pw.decreaseIndent();
pw.println("}");
@@ -335,6 +337,7 @@
private static final String ATTR_PACKAGE_NAME = "packageName";
private static final String ATTR_STATE = "state";
private static final String ATTR_TARGET_PACKAGE_NAME = "targetPackageName";
+ private static final String ATTR_TARGET_OVERLAYABLE_NAME = "targetOverlayableName";
private static final String ATTR_IS_STATIC = "isStatic";
private static final String ATTR_PRIORITY = "priority";
private static final String ATTR_CATEGORY = "category";
@@ -387,6 +390,8 @@
final int userId = XmlUtils.readIntAttribute(parser, ATTR_USER_ID);
final String targetPackageName = XmlUtils.readStringAttribute(parser,
ATTR_TARGET_PACKAGE_NAME);
+ final String targetOverlayableName = XmlUtils.readStringAttribute(parser,
+ ATTR_TARGET_OVERLAYABLE_NAME);
final String baseCodePath = XmlUtils.readStringAttribute(parser, ATTR_BASE_CODE_PATH);
final int state = XmlUtils.readIntAttribute(parser, ATTR_STATE);
final boolean isEnabled = XmlUtils.readBooleanAttribute(parser, ATTR_IS_ENABLED);
@@ -394,8 +399,8 @@
final int priority = XmlUtils.readIntAttribute(parser, ATTR_PRIORITY);
final String category = XmlUtils.readStringAttribute(parser, ATTR_CATEGORY);
- return new SettingsItem(packageName, userId, targetPackageName, baseCodePath,
- state, isEnabled, isStatic, priority, category);
+ return new SettingsItem(packageName, userId, targetPackageName, targetOverlayableName,
+ baseCodePath, state, isEnabled, isStatic, priority, category);
}
public static void persist(@NonNull final ArrayList<SettingsItem> table,
@@ -422,6 +427,8 @@
XmlUtils.writeStringAttribute(xml, ATTR_PACKAGE_NAME, item.mPackageName);
XmlUtils.writeIntAttribute(xml, ATTR_USER_ID, item.mUserId);
XmlUtils.writeStringAttribute(xml, ATTR_TARGET_PACKAGE_NAME, item.mTargetPackageName);
+ XmlUtils.writeStringAttribute(xml, ATTR_TARGET_OVERLAYABLE_NAME,
+ item.mTargetOverlayableName);
XmlUtils.writeStringAttribute(xml, ATTR_BASE_CODE_PATH, item.mBaseCodePath);
XmlUtils.writeIntAttribute(xml, ATTR_STATE, item.mState);
XmlUtils.writeBooleanAttribute(xml, ATTR_IS_ENABLED, item.mIsEnabled);
@@ -436,6 +443,7 @@
private final int mUserId;
private final String mPackageName;
private final String mTargetPackageName;
+ private final String mTargetOverlayableName;
private String mBaseCodePath;
private @OverlayInfo.State int mState;
private boolean mIsEnabled;
@@ -445,12 +453,14 @@
private String mCategory;
SettingsItem(@NonNull final String packageName, final int userId,
- @NonNull final String targetPackageName, @NonNull final String baseCodePath,
+ @NonNull final String targetPackageName,
+ @Nullable final String targetOverlayableName, @NonNull final String baseCodePath,
final @OverlayInfo.State int state, final boolean isEnabled, final boolean isStatic,
- final int priority, String category) {
+ final int priority, @Nullable String category) {
mPackageName = packageName;
mUserId = userId;
mTargetPackageName = targetPackageName;
+ mTargetOverlayableName = targetOverlayableName;
mBaseCodePath = baseCodePath;
mState = state;
mIsEnabled = isEnabled || isStatic;
@@ -461,16 +471,21 @@
}
SettingsItem(@NonNull final String packageName, final int userId,
- @NonNull final String targetPackageName, @NonNull final String baseCodePath,
- final boolean isStatic, final int priority, String category) {
- this(packageName, userId, targetPackageName, baseCodePath, OverlayInfo.STATE_UNKNOWN,
- false, isStatic, priority, category);
+ @NonNull final String targetPackageName,
+ @Nullable final String targetOverlayableName, @NonNull final String baseCodePath,
+ final boolean isStatic, final int priority, @Nullable String category) {
+ this(packageName, userId, targetPackageName, targetOverlayableName, baseCodePath,
+ OverlayInfo.STATE_UNKNOWN, false, isStatic, priority, category);
}
private String getTargetPackageName() {
return mTargetPackageName;
}
+ private String getTargetOverlayableName() {
+ return mTargetOverlayableName;
+ }
+
private int getUserId() {
return mUserId;
}
@@ -520,7 +535,7 @@
private boolean setCategory(String category) {
if (!Objects.equals(mCategory, category)) {
- mCategory = category.intern();
+ mCategory = (category == null) ? null : category.intern();
invalidateCache();
return true;
}
@@ -529,8 +544,8 @@
private OverlayInfo getOverlayInfo() {
if (mCache == null) {
- mCache = new OverlayInfo(mPackageName, mTargetPackageName, mCategory, mBaseCodePath,
- mState, mUserId, mPriority, mIsStatic);
+ mCache = new OverlayInfo(mPackageName, mTargetPackageName, mTargetOverlayableName,
+ mCategory, mBaseCodePath, mState, mUserId, mPriority, mIsStatic);
}
return mCache;
}
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
index e36ac23..40f2a2b 100644
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
@@ -1552,13 +1552,13 @@
oldPermAreModernStorageModel = false;
}
- boolean shouldBeRestricted;
+ boolean shouldBeHidden;
boolean shouldBeFixed;
boolean shouldBeGranted = false;
boolean shouldBeRevoked = false;
int userFlags = -1;
if (useLegacyStoragePermissionModel) {
- shouldBeRestricted = isModernStoragePermission;
+ shouldBeHidden = isModernStoragePermission;
shouldBeFixed = isQApp || isModernStoragePermission;
if (shouldBeFixed) {
@@ -1576,7 +1576,7 @@
shouldBeRevoked = !shouldBeGranted;
}
} else {
- shouldBeRestricted = isLegacyStoragePermission;
+ shouldBeHidden = isLegacyStoragePermission;
shouldBeFixed = isLegacyStoragePermission;
if (shouldBeFixed) {
@@ -1636,7 +1636,12 @@
changed |= ps.updatePermissionFlags(mSettings.getPermissionLocked(perm), userId,
FLAG_PERMISSION_HIDDEN,
- shouldBeRestricted ? FLAG_PERMISSION_HIDDEN : 0);
+ shouldBeHidden ? FLAG_PERMISSION_HIDDEN : 0);
+
+ if (shouldBeHidden) {
+ changed |= ps.updatePermissionFlags(mSettings.getPermissionLocked(perm),
+ userId, FLAG_PERMISSION_REVIEW_REQUIRED, 0);
+ }
}
if (changed) {
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index 9b427f5..cfe11bf 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -4489,8 +4489,7 @@
}
@Override // Binder call
- public boolean setDynamicPowerSavings(boolean dynamicPowerSavingsEnabled,
- int disableThreshold) {
+ public boolean setDynamicPowerSaveHint(boolean powerSaveHint, int disableThreshold) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.POWER_SAVER,
"updateDynamicPowerSavings");
final long ident = Binder.clearCallingIdentity();
@@ -4503,7 +4502,7 @@
// abort updating if we weren't able to succeed on the threshold
success &= Settings.Global.putInt(resolver,
Settings.Global.DYNAMIC_POWER_SAVINGS_ENABLED,
- dynamicPowerSavingsEnabled ? 1 : 0);
+ powerSaveHint ? 1 : 0);
}
return success;
} finally {
@@ -4542,13 +4541,13 @@
}
@Override // Binder call
- public int getPowerSaveMode() {
+ public int getPowerSaveModeTrigger() {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.POWER_SAVER, null);
final long ident = Binder.clearCallingIdentity();
try {
return Settings.Global.getInt(mContext.getContentResolver(),
- Settings.Global.AUTOMATIC_POWER_SAVER_MODE,
- PowerManager.POWER_SAVER_MODE_PERCENTAGE);
+ Settings.Global.AUTOMATIC_POWER_SAVE_MODE,
+ PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE);
} finally {
Binder.restoreCallingIdentity(ident);
}
diff --git a/services/core/java/com/android/server/power/batterysaver/BatterySaverStateMachine.java b/services/core/java/com/android/server/power/batterysaver/BatterySaverStateMachine.java
index 61daca7..b7be768 100644
--- a/services/core/java/com/android/server/power/batterysaver/BatterySaverStateMachine.java
+++ b/services/core/java/com/android/server/power/batterysaver/BatterySaverStateMachine.java
@@ -188,7 +188,7 @@
@GuardedBy("mLock")
private int mSettingBatterySaverTriggerThreshold;
- /** Previously known value of Settings.Global.AUTOMATIC_POWER_SAVER_MODE. */
+ /** Previously known value of Settings.Global.AUTOMATIC_POWER_SAVE_MODE. */
@GuardedBy("mLock")
private int mSettingAutomaticBatterySaver;
@@ -248,7 +248,7 @@
/** @return true if the automatic percentage based mode should be used */
private boolean isAutomaticModeActiveLocked() {
- return mSettingAutomaticBatterySaver == PowerManager.POWER_SAVER_MODE_PERCENTAGE
+ return mSettingAutomaticBatterySaver == PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE
&& mSettingBatterySaverTriggerThreshold > 0;
}
@@ -264,7 +264,7 @@
/** @return true if the dynamic mode should be used */
private boolean isDynamicModeActiveLocked() {
- return mSettingAutomaticBatterySaver == PowerManager.POWER_SAVER_MODE_DYNAMIC
+ return mSettingAutomaticBatterySaver == PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC
&& mDynamicPowerSavingsBatterySaver;
}
@@ -304,7 +304,7 @@
Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL),
false, mSettingsObserver, UserHandle.USER_SYSTEM);
cr.registerContentObserver(Settings.Global.getUriFor(
- Settings.Global.AUTOMATIC_POWER_SAVER_MODE),
+ Settings.Global.AUTOMATIC_POWER_SAVE_MODE),
false, mSettingsObserver, UserHandle.USER_SYSTEM);
cr.registerContentObserver(Settings.Global.getUriFor(
Settings.Global.DYNAMIC_POWER_SAVINGS_ENABLED),
@@ -367,8 +367,8 @@
final int lowPowerModeTriggerLevel = getGlobalSetting(
Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, 0);
final int automaticBatterySaverMode = getGlobalSetting(
- Settings.Global.AUTOMATIC_POWER_SAVER_MODE,
- PowerManager.POWER_SAVER_MODE_PERCENTAGE);
+ Settings.Global.AUTOMATIC_POWER_SAVE_MODE,
+ PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE);
final int dynamicPowerSavingsDisableThreshold = getGlobalSetting(
Settings.Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD,
mDynamicPowerSavingsDefaultDisableThreshold);
diff --git a/services/core/java/com/android/server/wm/TaskScreenshotAnimatable.java b/services/core/java/com/android/server/wm/TaskScreenshotAnimatable.java
index e0d85e8..4379b7c 100644
--- a/services/core/java/com/android/server/wm/TaskScreenshotAnimatable.java
+++ b/services/core/java/com/android/server/wm/TaskScreenshotAnimatable.java
@@ -41,7 +41,7 @@
return new TaskScreenshotAnimatable(task, getBufferFromTask(task));
}
- private static GraphicBuffer getBufferFromTask(Task task) {
+ private static SurfaceControl.ScreenshotGraphicBuffer getBufferFromTask(Task task) {
if (task == null) {
return null;
}
@@ -51,7 +51,10 @@
task.getSurfaceControl().getHandle(), tmpRect, 1f);
}
- private TaskScreenshotAnimatable(Task task, GraphicBuffer buffer) {
+ private TaskScreenshotAnimatable(Task task,
+ SurfaceControl.ScreenshotGraphicBuffer screenshotBuffer) {
+ GraphicBuffer buffer = screenshotBuffer == null
+ ? null : screenshotBuffer.getGraphicBuffer();
mTask = task;
mWidth = (buffer != null) ? buffer.getWidth() : 1;
mHeight = (buffer != null) ? buffer.getHeight() : 1;
diff --git a/services/core/java/com/android/server/wm/TaskSnapshotController.java b/services/core/java/com/android/server/wm/TaskSnapshotController.java
index beb3d82..6fe8b43 100644
--- a/services/core/java/com/android/server/wm/TaskSnapshotController.java
+++ b/services/core/java/com/android/server/wm/TaskSnapshotController.java
@@ -279,8 +279,11 @@
Slog.w(TAG_WM, "Failed to take screenshot. No main window for " + task);
return null;
}
- final GraphicBuffer buffer = SurfaceControl.captureLayers(
- task.getSurfaceControl().getHandle(), mTmpRect, scaleFraction);
+ final SurfaceControl.ScreenshotGraphicBuffer screenshotBuffer =
+ SurfaceControl.captureLayers(
+ task.getSurfaceControl().getHandle(), mTmpRect, scaleFraction);
+ final GraphicBuffer buffer = screenshotBuffer != null ? screenshotBuffer.getGraphicBuffer()
+ : null;
if (buffer == null || buffer.getWidth() <= 1 || buffer.getHeight() <= 1) {
if (DEBUG_SCREENSHOT) {
Slog.w(TAG_WM, "Failed to take screenshot for " + task);
diff --git a/services/core/java/com/android/server/wm/WallpaperController.java b/services/core/java/com/android/server/wm/WallpaperController.java
index dddc6b7..166a33d 100644
--- a/services/core/java/com/android/server/wm/WallpaperController.java
+++ b/services/core/java/com/android/server/wm/WallpaperController.java
@@ -34,8 +34,6 @@
import static com.android.server.wm.WindowManagerService.H.WALLPAPER_DRAW_PENDING_TIMEOUT;
import android.graphics.Bitmap;
-import android.graphics.ColorSpace;
-import android.graphics.GraphicBuffer;
import android.graphics.Rect;
import android.hardware.HardwareBuffer;
import android.os.Bundle;
@@ -738,17 +736,16 @@
final Rect bounds = wallpaperWindowState.getBounds();
bounds.offsetTo(0, 0);
- GraphicBuffer wallpaperBuffer = SurfaceControl.captureLayers(
+ SurfaceControl.ScreenshotGraphicBuffer wallpaperBuffer = SurfaceControl.captureLayers(
wallpaperWindowState.getSurfaceControl().getHandle(), bounds, 1 /* frameScale */);
if (wallpaperBuffer == null) {
Slog.w(TAG_WM, "Failed to screenshot wallpaper");
return null;
}
- // TODO(b/116112787) Now that hardware bitmap creation can take color space, we
- // should continue to fix screenshot.
- return Bitmap.wrapHardwareBuffer(HardwareBuffer.createFromGraphicBuffer(wallpaperBuffer),
- ColorSpace.get(ColorSpace.Named.SRGB));
+ return Bitmap.wrapHardwareBuffer(
+ HardwareBuffer.createFromGraphicBuffer(wallpaperBuffer.getGraphicBuffer()),
+ wallpaperBuffer.getColorSpace());
}
private WindowState getTopVisibleWallpaper() {
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 4ff5d61..633367a 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -5249,12 +5249,11 @@
// would allow bypassing of the maximum time to lock.
mInjector.settingsGlobalPutInt(Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0);
}
+ getPowerManagerInternal().setMaximumScreenOffTimeoutFromDeviceAdmin(
+ UserHandle.USER_SYSTEM, timeMs);
} finally {
mInjector.binderRestoreCallingIdentity(ident);
}
-
- getPowerManagerInternal().setMaximumScreenOffTimeoutFromDeviceAdmin(
- UserHandle.USER_SYSTEM, timeMs);
}
private void updateProfileLockTimeoutLocked(@UserIdInt int userId) {
@@ -5272,8 +5271,13 @@
}
policy.mLastMaximumTimeToLock = timeMs;
- getPowerManagerInternal().setMaximumScreenOffTimeoutFromDeviceAdmin(
- userId, policy.mLastMaximumTimeToLock);
+ final long ident = mInjector.binderClearCallingIdentity();
+ try {
+ getPowerManagerInternal().setMaximumScreenOffTimeoutFromDeviceAdmin(
+ userId, policy.mLastMaximumTimeToLock);
+ } finally {
+ mInjector.binderRestoreCallingIdentity(ident);
+ }
}
@Override
diff --git a/services/tests/mockingservicestests/src/com/android/server/power/batterysaver/BatterySaverStateMachineTest.java b/services/tests/mockingservicestests/src/com/android/server/power/batterysaver/BatterySaverStateMachineTest.java
index 2e5efbd..212d2a8 100644
--- a/services/tests/mockingservicestests/src/com/android/server/power/batterysaver/BatterySaverStateMachineTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/power/batterysaver/BatterySaverStateMachineTest.java
@@ -112,7 +112,7 @@
Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED, 0) != 0,
mPersistedState.global.getOrDefault(
Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL, 90),
- mPersistedState.global.getOrDefault(Global.AUTOMATIC_POWER_SAVER_MODE, 0),
+ mPersistedState.global.getOrDefault(Global.AUTOMATIC_POWER_SAVE_MODE, 0),
mPersistedState.global.getOrDefault(
Global.DYNAMIC_POWER_SAVINGS_ENABLED, 0) != 0,
mPersistedState.global.getOrDefault(
@@ -321,7 +321,7 @@
@Test
public void testAutoBatterySaver() {
mDevice.putGlobalSetting(Global.LOW_POWER_MODE_TRIGGER_LEVEL, 50);
- mDevice.putGlobalSetting(Global.AUTOMATIC_POWER_SAVER_MODE, 0);
+ mDevice.putGlobalSetting(Global.AUTOMATIC_POWER_SAVE_MODE, 0);
assertEquals(false, mDevice.batterySaverEnabled);
assertEquals(100, mPersistedState.batteryLevel);
@@ -789,7 +789,7 @@
.thenReturn(true);
initDevice();
mDevice.putGlobalSetting(Global.LOW_POWER_MODE_TRIGGER_LEVEL, 50);
- mDevice.putGlobalSetting(Global.AUTOMATIC_POWER_SAVER_MODE, 0);
+ mDevice.putGlobalSetting(Global.AUTOMATIC_POWER_SAVE_MODE, 0);
mTarget.setBatterySaverEnabledManually(true);
@@ -906,8 +906,8 @@
@Test
public void testAutoBatterySaver_smartBatterySaverEnabled() {
mDevice.putGlobalSetting(Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD, 50);
- mDevice.putGlobalSetting(Global.AUTOMATIC_POWER_SAVER_MODE,
- PowerManager.POWER_SAVER_MODE_DYNAMIC);
+ mDevice.putGlobalSetting(Global.AUTOMATIC_POWER_SAVE_MODE,
+ PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC);
mDevice.putGlobalSetting(Global.DYNAMIC_POWER_SAVINGS_ENABLED, 0);
assertEquals(false, mDevice.batterySaverEnabled);
@@ -1029,8 +1029,8 @@
// Test dynamic threshold higher than automatic to make sure it doesn't interfere when it's
// not enabled.
mDevice.putGlobalSetting(Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD, 50);
- mDevice.putGlobalSetting(Global.AUTOMATIC_POWER_SAVER_MODE,
- PowerManager.POWER_SAVER_MODE_PERCENTAGE);
+ mDevice.putGlobalSetting(Global.AUTOMATIC_POWER_SAVE_MODE,
+ PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE);
mDevice.putGlobalSetting(Global.DYNAMIC_POWER_SAVINGS_ENABLED, 0);
assertEquals(false, mDevice.batterySaverEnabled);
@@ -1138,8 +1138,8 @@
// not enabled.
mDevice.putGlobalSetting(Global.LOW_POWER_MODE_TRIGGER_LEVEL, 50);
mDevice.putGlobalSetting(Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD, 30);
- mDevice.putGlobalSetting(Global.AUTOMATIC_POWER_SAVER_MODE,
- PowerManager.POWER_SAVER_MODE_DYNAMIC);
+ mDevice.putGlobalSetting(Global.AUTOMATIC_POWER_SAVE_MODE,
+ PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC);
mDevice.putGlobalSetting(Global.DYNAMIC_POWER_SAVINGS_ENABLED, 1);
assertEquals(false, mDevice.batterySaverEnabled);
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
index a8da80e..426122a 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
@@ -353,7 +353,6 @@
FileOutputStream fos = mPolicyFile.startWrite();
fos.write(preupgradeXml.getBytes());
mPolicyFile.finishWrite(fos);
- FileInputStream fStream = new FileInputStream(mFile);
// Setup managed services
mListener = mListeners.new ManagedServiceInfo(
@@ -369,6 +368,8 @@
dndConfig.xmlTag = ConditionProviders.TAG_ENABLED_DND_APPS;
when(mConditionProviders.getConfig()).thenReturn(dndConfig);
+ when(mAssistants.isAdjustmentAllowed(anyString())).thenReturn(true);
+
try {
mService.init(mTestableLooper.getLooper(),
mPackageManager, mPackageManagerClient, mockLightsManager,
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java
index 23bae88..de4fb98 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java
@@ -37,6 +37,7 @@
import android.platform.test.annotations.Presubmit;
import android.util.SparseIntArray;
+import androidx.test.filters.FlakyTest;
import androidx.test.filters.SmallTest;
import com.android.server.wm.ActivityMetricsLaunchObserver.ActivityRecordProto;
@@ -118,6 +119,7 @@
}
@Test
+ @FlakyTest(bugId = 129138370)
public void testOnIntentStarted() throws Exception {
Intent intent = new Intent("action 1");
@@ -128,6 +130,7 @@
}
@Test
+ @FlakyTest(bugId = 129138370)
public void testOnIntentFailed() throws Exception {
testOnIntentStarted();
@@ -143,6 +146,7 @@
}
@Test
+ @FlakyTest(bugId = 129138370)
public void testOnActivityLaunched() throws Exception {
testOnIntentStarted();
@@ -154,6 +158,7 @@
}
@Test
+ @FlakyTest(bugId = 129138370)
public void testOnActivityLaunchFinished() throws Exception {
testOnActivityLaunched();
@@ -168,6 +173,7 @@
}
@Test
+ @FlakyTest(bugId = 129138370)
public void testOnActivityLaunchCancelled() throws Exception {
testOnActivityLaunched();
@@ -181,6 +187,7 @@
}
@Test
+ @FlakyTest(bugId = 129138370)
public void testOnActivityLaunchedTrampoline() throws Exception {
testOnIntentStarted();
@@ -197,6 +204,7 @@
}
@Test
+ @FlakyTest(bugId = 129138370)
public void testOnActivityLaunchFinishedTrampoline() throws Exception {
testOnActivityLaunchedTrampoline();
@@ -211,6 +219,7 @@
}
@Test
+ @FlakyTest(bugId = 129138370)
public void testOnActivityLaunchCancelledTrampoline() throws Exception {
testOnActivityLaunchedTrampoline();
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 75e6186..63a0ae0 100755
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -1868,6 +1868,16 @@
public static final String KEY_CARRIER_WIFI_STRING_ARRAY = "carrier_wifi_string_array";
/**
+ * Base64 Encoding method the carrier will use for encoding encrypted IMSI and SSID.
+ * The value set as below:
+ * 2045 - RFC2045 (default value)
+ * 4648 - RFC4648
+ *
+ * @hide
+ */
+ public static final String KEY_IMSI_ENCODING_METHOD_INT = "imsi_encoding_method_int";
+
+ /**
* Time delay (in ms) after which we show the notification to switch the preferred
* network.
* @hide
@@ -2999,6 +3009,7 @@
sDefaults.putBoolean(KEY_USE_WFC_HOME_NETWORK_MODE_IN_ROAMING_NETWORK_BOOL, false);
sDefaults.putBoolean(KEY_STK_DISABLE_LAUNCH_BROWSER_BOOL, false);
sDefaults.putStringArray(KEY_CARRIER_WIFI_STRING_ARRAY, null);
+ sDefaults.putInt(KEY_IMSI_ENCODING_METHOD_INT, 2045);
sDefaults.putInt(KEY_PREF_NETWORK_NOTIFICATION_DELAY_INT, -1);
sDefaults.putInt(KEY_EMERGENCY_NOTIFICATION_DELAY_INT, -1);
sDefaults.putBoolean(KEY_ALLOW_USSD_REQUESTS_VIA_TELEPHONY_MANAGER_BOOL, true);
diff --git a/test-mock/api/test-current.txt b/test-mock/api/test-current.txt
index 6765316..a87e2f5 100644
--- a/test-mock/api/test-current.txt
+++ b/test-mock/api/test-current.txt
@@ -3,6 +3,7 @@
public class MockContext extends android.content.Context {
method public android.view.Display getDisplay();
+ method public int getDisplayId();
}
@Deprecated public class MockPackageManager extends android.content.pm.PackageManager {