Merge "Fix flaky UdpEncapsulationSocket test" am: 13078345c5 am: ae9f7b6723
am: 614ab3dd4e
Change-Id: Iad9aea4b42cd8b31a5a2659bb9cb54dd1c64e8b7
diff --git a/api/current.txt b/api/current.txt
index f78dfde..9776a11 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -11607,7 +11607,7 @@
method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceivers(@NonNull android.content.Intent, int);
method @NonNull public abstract java.util.List<android.content.pm.ProviderInfo> queryContentProviders(@Nullable String, int, int);
method @NonNull public abstract java.util.List<android.content.pm.InstrumentationInfo> queryInstrumentation(@NonNull String, int);
- method @Nullable public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentActivities(@NonNull android.content.Intent, int);
+ method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentActivities(@NonNull android.content.Intent, int);
method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentActivityOptions(@Nullable android.content.ComponentName, @Nullable android.content.Intent[], @NonNull android.content.Intent, int);
method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentContentProviders(@NonNull android.content.Intent, int);
method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentServices(@NonNull android.content.Intent, int);
diff --git a/core/java/android/app/ApplicationLoaders.java b/core/java/android/app/ApplicationLoaders.java
index faa30f3..2e59b90 100644
--- a/core/java/android/app/ApplicationLoaders.java
+++ b/core/java/android/app/ApplicationLoaders.java
@@ -145,8 +145,7 @@
*/
public void createAndCacheNonBootclasspathSystemClassLoaders(SharedLibraryInfo[] libs) {
if (mSystemLibsCacheMap != null) {
- Log.wtf(TAG, "Already cached.");
- return;
+ throw new IllegalStateException("Already cached.");
}
mSystemLibsCacheMap = new HashMap<String, CachedClassLoader>();
@@ -159,7 +158,8 @@
/**
* Caches a single non-bootclasspath class loader.
*
- * All of this library's dependencies must have previously been cached.
+ * All of this library's dependencies must have previously been cached. Otherwise, an exception
+ * is thrown.
*/
private void createAndCacheNonBootclasspathSystemClassLoader(SharedLibraryInfo lib) {
String path = lib.getPath();
@@ -174,9 +174,8 @@
CachedClassLoader cached = mSystemLibsCacheMap.get(dependencyPath);
if (cached == null) {
- Log.e(TAG, "Failed to find dependency " + dependencyPath
- + " of cached library " + path);
- return;
+ throw new IllegalStateException("Failed to find dependency " + dependencyPath
+ + " of cachedlibrary " + path);
}
sharedLibraries.add(cached.loader);
@@ -189,8 +188,8 @@
null /*cacheKey*/, null /*classLoaderName*/, sharedLibraries /*sharedLibraries*/);
if (classLoader == null) {
- Log.e(TAG, "Failed to cache " + path);
- return;
+ // bad configuration or break in classloading code
+ throw new IllegalStateException("Failed to cache " + path);
}
CachedClassLoader cached = new CachedClassLoader();
@@ -215,7 +214,7 @@
*
* If there is an error or the cache is not available, this returns null.
*/
- private ClassLoader getCachedNonBootclasspathSystemLib(String zip, ClassLoader parent,
+ public ClassLoader getCachedNonBootclasspathSystemLib(String zip, ClassLoader parent,
String classLoaderName, List<ClassLoader> sharedLibraries) {
if (mSystemLibsCacheMap == null) {
return null;
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index f0539c49..025d8f9 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -4423,7 +4423,7 @@
* {@link #resolveActivity}. If there are no matching activities, an
* empty list is returned.
*/
- @Nullable
+ @NonNull
public abstract List<ResolveInfo> queryIntentActivities(@NonNull Intent intent,
@ResolveInfoFlags int flags);
@@ -4444,7 +4444,7 @@
* empty list is returned.
* @hide
*/
- @Nullable
+ @NonNull
@UnsupportedAppUsage
public abstract List<ResolveInfo> queryIntentActivitiesAsUser(@NonNull Intent intent,
@ResolveInfoFlags int flags, @UserIdInt int userId);
diff --git a/core/java/android/hardware/display/ColorDisplayManager.java b/core/java/android/hardware/display/ColorDisplayManager.java
index 0c07a67..ce71db6 100644
--- a/core/java/android/hardware/display/ColorDisplayManager.java
+++ b/core/java/android/hardware/display/ColorDisplayManager.java
@@ -392,6 +392,26 @@
}
/**
+ * Enables or disables display white balance.
+ *
+ * @hide
+ */
+ @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS)
+ public boolean setDisplayWhiteBalanceEnabled(boolean enabled) {
+ return mManager.setDisplayWhiteBalanceEnabled(enabled);
+ }
+
+ /**
+ * Returns whether display white balance is currently enabled. Even if enabled, it may or may
+ * not be active, if another transform with higher priority is active.
+ *
+ * @hide
+ */
+ public boolean isDisplayWhiteBalanceEnabled() {
+ return mManager.isDisplayWhiteBalanceEnabled();
+ }
+
+ /**
* Returns {@code true} if Night Display is supported by the device.
*
* @hide
@@ -616,6 +636,22 @@
}
}
+ boolean isDisplayWhiteBalanceEnabled() {
+ try {
+ return mCdm.isDisplayWhiteBalanceEnabled();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ boolean setDisplayWhiteBalanceEnabled(boolean enabled) {
+ try {
+ return mCdm.setDisplayWhiteBalanceEnabled(enabled);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
int getColorMode() {
try {
return mCdm.getColorMode();
diff --git a/core/java/android/hardware/display/IColorDisplayManager.aidl b/core/java/android/hardware/display/IColorDisplayManager.aidl
index 88b59a6..7b1033d 100644
--- a/core/java/android/hardware/display/IColorDisplayManager.aidl
+++ b/core/java/android/hardware/display/IColorDisplayManager.aidl
@@ -42,4 +42,7 @@
int getColorMode();
void setColorMode(int colorMode);
+
+ boolean isDisplayWhiteBalanceEnabled();
+ boolean setDisplayWhiteBalanceEnabled(boolean enabled);
}
\ No newline at end of file
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 00d522b..ecd16dd 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -266,8 +266,11 @@
* - Fixed bug in min learned capacity updating process.
* New in version 34:
* - Deprecated STATS_SINCE_UNPLUGGED and STATS_CURRENT.
+ * New in version 35:
+ * - Fixed bug that was not reporting high cellular tx power correctly
+ * - Added out of service and emergency service modes to data connection types
*/
- static final int CHECKIN_VERSION = 34;
+ static final int CHECKIN_VERSION = 35;
/**
* Old version, we hit 9 and ran out of room, need to remove.
@@ -2371,18 +2374,21 @@
*/
public abstract int getMobileRadioActiveUnknownCount(int which);
- public static final int DATA_CONNECTION_NONE = 0;
- public static final int DATA_CONNECTION_OTHER = TelephonyManager.MAX_NETWORK_TYPE + 1;
+ public static final int DATA_CONNECTION_OUT_OF_SERVICE = 0;
+ public static final int DATA_CONNECTION_EMERGENCY_SERVICE =
+ TelephonyManager.MAX_NETWORK_TYPE + 1;
+ public static final int DATA_CONNECTION_OTHER = DATA_CONNECTION_EMERGENCY_SERVICE + 1;
+
static final String[] DATA_CONNECTION_NAMES = {
- "none", "gprs", "edge", "umts", "cdma", "evdo_0", "evdo_A",
+ "oos", "gprs", "edge", "umts", "cdma", "evdo_0", "evdo_A",
"1xrtt", "hsdpa", "hsupa", "hspa", "iden", "evdo_b", "lte",
"ehrpd", "hspap", "gsm", "td_scdma", "iwlan", "lte_ca", "nr",
- "other"
+ "emngcy", "other"
};
@UnsupportedAppUsage
- public static final int NUM_DATA_CONNECTION_TYPES = DATA_CONNECTION_OTHER+1;
+ public static final int NUM_DATA_CONNECTION_TYPES = DATA_CONNECTION_OTHER + 1;
/**
* Returns the time in microseconds that the phone has been running with
@@ -6564,6 +6570,10 @@
}
oldState = rec.states;
oldState2 = rec.states2;
+ // Clear High Tx Power Flag for volta positioning
+ if ((rec.states2 & HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG) != 0) {
+ rec.states2 &= ~HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG;
+ }
}
return item.toString();
@@ -7865,9 +7875,9 @@
// Phone data connection (DATA_CONNECTION_TIME_DATA and DATA_CONNECTION_COUNT_DATA)
for (int i = 0; i < NUM_DATA_CONNECTION_TYPES; ++i) {
// Map OTHER to TelephonyManager.NETWORK_TYPE_UNKNOWN and mark NONE as a boolean.
- boolean isNone = (i == DATA_CONNECTION_NONE);
+ boolean isNone = (i == DATA_CONNECTION_OUT_OF_SERVICE);
int telephonyNetworkType = i;
- if (i == DATA_CONNECTION_OTHER) {
+ if (i == DATA_CONNECTION_OTHER || i == DATA_CONNECTION_EMERGENCY_SERVICE) {
telephonyNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
}
final long pdcToken = proto.start(SystemProto.DATA_CONNECTION);
diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl
index 114d31f..9f860e2 100644
--- a/core/java/com/android/internal/app/IBatteryStats.aidl
+++ b/core/java/com/android/internal/app/IBatteryStats.aidl
@@ -106,7 +106,7 @@
void notePhoneOn();
void notePhoneOff();
void notePhoneSignalStrength(in SignalStrength signalStrength);
- void notePhoneDataConnectionState(int dataType, boolean hasData);
+ void notePhoneDataConnectionState(int dataType, boolean hasData, int serviceType);
void notePhoneState(int phoneState);
void noteWifiOn();
void noteWifiOff();
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 1fc7635..8f37d81 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -907,8 +907,6 @@
@VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
protected StopwatchTimer mBluetoothScanTimer;
- boolean mIsCellularTxPowerHigh = false;
-
int mMobileRadioPowerState = DataConnectionRealTimeInfo.DC_POWER_STATE_LOW;
long mMobileRadioActiveStartTime;
StopwatchTimer mMobileRadioActiveTimer;
@@ -5275,16 +5273,26 @@
}
@UnsupportedAppUsage
- public void notePhoneDataConnectionStateLocked(int dataType, boolean hasData) {
+ public void notePhoneDataConnectionStateLocked(int dataType, boolean hasData, int serviceType) {
// BatteryStats uses 0 to represent no network type.
// Telephony does not have a concept of no network type, and uses 0 to represent unknown.
// Unknown is included in DATA_CONNECTION_OTHER.
- int bin = DATA_CONNECTION_NONE;
+ int bin = DATA_CONNECTION_OUT_OF_SERVICE;
if (hasData) {
if (dataType > 0 && dataType <= TelephonyManager.MAX_NETWORK_TYPE) {
bin = dataType;
} else {
- bin = DATA_CONNECTION_OTHER;
+ switch (serviceType) {
+ case ServiceState.STATE_OUT_OF_SERVICE:
+ bin = DATA_CONNECTION_OUT_OF_SERVICE;
+ break;
+ case ServiceState.STATE_EMERGENCY_ONLY:
+ bin = DATA_CONNECTION_EMERGENCY_SERVICE;
+ break;
+ default:
+ bin = DATA_CONNECTION_OTHER;
+ break;
+ }
}
}
if (DEBUG) Log.i(TAG, "Phone Data Connection -> " + dataType + " = " + hasData);
@@ -11198,19 +11206,9 @@
}
}
if (levelMaxTimeSpent == ModemActivityInfo.TX_POWER_LEVELS - 1) {
- if (!mIsCellularTxPowerHigh) {
- mHistoryCur.states2 |= HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG;
- addHistoryRecordLocked(elapsedRealtime, uptime);
- mIsCellularTxPowerHigh = true;
- }
- return;
- }
- if (mIsCellularTxPowerHigh) {
- mHistoryCur.states2 &= ~HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG;
+ mHistoryCur.states2 |= HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG;
addHistoryRecordLocked(elapsedRealtime, uptime);
- mIsCellularTxPowerHigh = false;
}
- return;
}
private final class BluetoothActivityInfoCache {
@@ -13670,7 +13668,6 @@
mCameraOnTimer.readSummaryFromParcelLocked(in);
mBluetoothScanNesting = 0;
mBluetoothScanTimer.readSummaryFromParcelLocked(in);
- mIsCellularTxPowerHigh = false;
int NRPMS = in.readInt();
if (NRPMS > 10000) {
@@ -14654,7 +14651,6 @@
mCameraOnTimer = new StopwatchTimer(mClocks, null, -13, null, mOnBatteryTimeBase, in);
mBluetoothScanNesting = 0;
mBluetoothScanTimer = new StopwatchTimer(mClocks, null, -14, null, mOnBatteryTimeBase, in);
- mIsCellularTxPowerHigh = false;
mDischargeUnplugLevel = in.readInt();
mDischargePlugLevel = in.readInt();
mDischargeCurrentLevel = in.readInt();
diff --git a/core/res/res/drawable/perm_group_calendar.xml b/core/res/res/drawable/perm_group_calendar.xml
index 85a783e..4b46dd3 100644
--- a/core/res/res/drawable/perm_group_calendar.xml
+++ b/core/res/res/drawable/perm_group_calendar.xml
@@ -22,7 +22,8 @@
<path
android:fillColor="#000000"
- android:pathData="M17 12h-5v5h5v-5zM16 1v2H8V1H6v2H5c-1.11 0-1.99 .9 -1.99 2L3 19c0 1.1 .89 2 2
-2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1h-2zm3 18H5V8h14v11z" />
+ android:pathData="M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99 0.9 -1.99 2L3 20c0 1.1 0.89 2 2 2h14c1.1 0 2-0.9 2-2V6c0-1.1-0.9-2-2-2zm0 16H5V10h14v10zm-4.5-7c-1.38 0-2.5 1.12-2.5 2.5s1.12 2.5 2.5 2.5 2.5-1.12 2.5-2.5-1.12-2.5-2.5-2.5z" />
+ <path
+ android:pathData="M0 0h24v24H0V0z" />
</vector>
\ No newline at end of file
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 4b8a96c..6f3adfd 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1434,7 +1434,7 @@
<string name="permdesc_mediaLocation">Allows the app to read locations from your media collection.</string>
<!-- Title shown when the system-provided biometric dialog is shown, asking the user to authenticate. [CHAR LIMIT=40] -->
- <string name="biometric_dialog_default_title">Application <xliff:g id="app" example="Gmail">%s</xliff:g> wants to authenticate.</string>
+ <string name="biometric_dialog_default_title">Verify it\u2018s you</string>
<!-- Message shown when biometric hardware is not available [CHAR LIMIT=50] -->
<string name="biometric_error_hw_unavailable">Biometric hardware unavailable</string>
<!-- Message shown when biometric authentication was canceled by the user [CHAR LIMIT=50] -->
diff --git a/core/tests/coretests/src/android/app/ApplicationLoadersTest.java b/core/tests/coretests/src/android/app/ApplicationLoadersTest.java
new file mode 100644
index 0000000..4b9910c
--- /dev/null
+++ b/core/tests/coretests/src/android/app/ApplicationLoadersTest.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.app;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import android.content.pm.SharedLibraryInfo;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public class ApplicationLoadersTest {
+
+ // a library installed onto the device with no dependencies
+ private static final String LIB_A = "/system/framework/android.hidl.base-V1.0-java.jar";
+ // a library installed onto the device which only depends on A
+ private static final String LIB_DEP_A = "/system/framework/android.hidl.manager-V1.0-java.jar";
+
+ private static SharedLibraryInfo createLib(String zip) {
+ return new SharedLibraryInfo(
+ zip, null /*packageName*/, null /*codePaths*/, null /*name*/, 0 /*version*/,
+ SharedLibraryInfo.TYPE_BUILTIN, null /*declaringPackage*/,
+ null /*dependentPackages*/, null /*dependencies*/);
+ }
+
+ @Test
+ public void testGetNonExistantLib() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ assertEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ "/system/framework/nonexistantlib.jar", null, null, null));
+ }
+
+ @Test
+ public void testCacheExistantLib() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(new SharedLibraryInfo[]{libA});
+
+ assertNotEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ LIB_A, null, null, null));
+ }
+
+ @Test
+ public void testNonNullParent() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+
+ ClassLoader parent = ClassLoader.getSystemClassLoader();
+ assertNotEquals(null, parent);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(new SharedLibraryInfo[]{libA});
+
+ assertEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ LIB_A, parent, null, null));
+ }
+
+ @Test
+ public void testNonNullClassLoaderNamespace() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(new SharedLibraryInfo[]{libA});
+
+ assertEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ LIB_A, null, "other classloader", null));
+ }
+
+ @Test
+ public void testDifferentSharedLibraries() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+
+ // any other existant lib
+ ClassLoader dep = ClassLoader.getSystemClassLoader();
+ ArrayList<ClassLoader> sharedLibraries = new ArrayList<>();
+ sharedLibraries.add(dep);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(new SharedLibraryInfo[]{libA});
+
+ assertEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ LIB_A, null, null, sharedLibraries));
+ }
+
+ @Test
+ public void testDependentLibs() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+ SharedLibraryInfo libB = createLib(LIB_DEP_A);
+ libB.addDependency(libA);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(
+ new SharedLibraryInfo[]{libA, libB});
+
+ ClassLoader loadA = loaders.getCachedNonBootclasspathSystemLib(
+ LIB_A, null, null, null);
+ assertNotEquals(null, loadA);
+
+ ArrayList<ClassLoader> sharedLibraries = new ArrayList<>();
+ sharedLibraries.add(loadA);
+
+ assertNotEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ LIB_DEP_A, null, null, sharedLibraries));
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testDependentLibsWrongOrder() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+ SharedLibraryInfo libB = createLib(LIB_DEP_A);
+ libB.addDependency(libA);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(
+ new SharedLibraryInfo[]{libB, libA});
+ }
+}
diff --git a/libs/androidfw/Asset.cpp b/libs/androidfw/Asset.cpp
index 9a95fdf..92125c9 100644
--- a/libs/androidfw/Asset.cpp
+++ b/libs/androidfw/Asset.cpp
@@ -253,8 +253,10 @@
pAsset = new _FileAsset;
result = pAsset->openChunk(NULL, fd, offset, length);
- if (result != NO_ERROR)
+ if (result != NO_ERROR) {
+ delete pAsset;
return NULL;
+ }
pAsset->mAccessMode = mode;
return pAsset;
@@ -273,8 +275,10 @@
pAsset = new _CompressedAsset;
result = pAsset->openChunk(fd, offset, compressionMethod,
uncompressedLen, compressedLen);
- if (result != NO_ERROR)
+ if (result != NO_ERROR) {
+ delete pAsset;
return NULL;
+ }
pAsset->mAccessMode = mode;
return pAsset;
@@ -328,8 +332,10 @@
pAsset = new _CompressedAsset;
result = pAsset->openChunk(dataMap, uncompressedLen);
- if (result != NO_ERROR)
+ if (result != NO_ERROR) {
+ delete pAsset;
return NULL;
+ }
pAsset->mAccessMode = mode;
return pAsset;
diff --git a/media/java/android/media/AudioAttributes.java b/media/java/android/media/AudioAttributes.java
index 55f1911..3a33678 100644
--- a/media/java/android/media/AudioAttributes.java
+++ b/media/java/android/media/AudioAttributes.java
@@ -558,7 +558,7 @@
private int mContentType = CONTENT_TYPE_UNKNOWN;
private int mSource = MediaRecorder.AudioSource.AUDIO_SOURCE_INVALID;
private int mFlags = 0x0;
- private boolean mMuteHapticChannels = false;
+ private boolean mMuteHapticChannels = true;
private HashSet<String> mTags = new HashSet<String>();
private Bundle mBundle;
@@ -889,7 +889,7 @@
/**
* Specifying if haptic should be muted or not when playing audio-haptic coupled data.
- * By default, haptic channels are enabled.
+ * By default, haptic channels are disabled.
* @param muted true to force muting haptic channels.
* @return the same Builder instance.
*/
diff --git a/media/java/android/media/audiopolicy/AudioProductStrategy.java b/media/java/android/media/audiopolicy/AudioProductStrategy.java
index 48500e01..c1c255f 100644
--- a/media/java/android/media/audiopolicy/AudioProductStrategy.java
+++ b/media/java/android/media/audiopolicy/AudioProductStrategy.java
@@ -262,7 +262,7 @@
|| (attr.getContentType() == refAttr.getContentType()))
&& ((refAttr.getAllFlags() == 0)
|| (attr.getAllFlags() != 0
- && (attr.getAllFlags() & refAttr.getAllFlags()) == attr.getAllFlags()))
+ && (attr.getAllFlags() & refAttr.getAllFlags()) == refAttr.getAllFlags()))
&& ((refFormattedTags.length() == 0) || refFormattedTags.equals(cliFormattedTags));
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt b/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt
index 239b1d4..eff02d2 100644
--- a/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt
+++ b/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt
@@ -173,6 +173,7 @@
}
override fun draw(c: Canvas) {
+ c.saveLayer(null, null)
unifiedPath.reset()
levelPath.reset()
levelRect.set(fillRect)
@@ -243,6 +244,7 @@
// And draw the plus sign on top of the fill
c.drawPath(scaledPlus, errorPaint)
}
+ c.restore()
}
private fun batteryColorForLevel(level: Int): Int {
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/NotificationMenuRowPlugin.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/NotificationMenuRowPlugin.java
index fc84332..8f24e79 100644
--- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/NotificationMenuRowPlugin.java
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/NotificationMenuRowPlugin.java
@@ -14,7 +14,9 @@
package com.android.systemui.plugins.statusbar;
+import android.annotation.Nullable;
import android.content.Context;
+import android.graphics.Point;
import android.service.notification.StatusBarNotification;
import android.view.MotionEvent;
import android.view.View;
@@ -84,6 +86,38 @@
public void setMenuItems(ArrayList<MenuItem> items);
+ /**
+ * If this returns {@code true}, then the menu row will bind and fade in the notification guts
+ * view for the menu item it holds.
+ *
+ * @see #menuItemToExposeOnSnap()
+ * @return whether or not to immediately expose the notification guts
+ */
+ default boolean shouldShowGutsOnSnapOpen() {
+ return false;
+ }
+
+ /**
+ * When #shouldShowGutsOnExpose is true, this method must return the menu item to expose on
+ * #onSnapOpen. Otherwise we will fall back to the default behavior of fading in the menu row
+ *
+ * @return the {@link MenuItem} containing the NotificationGuts that should be exposed
+ */
+ @Nullable
+ default MenuItem menuItemToExposeOnSnap() {
+ return null;
+ }
+
+ /**
+ * Get the origin for the circular reveal animation when expanding the notification guts. Only
+ * used when #shouldShowGutsOnSnapOpen is true
+ * @return the x,y coordinates for the start of the animation
+ */
+ @Nullable
+ default Point getRevealAnimationOrigin() {
+ return new Point(0, 0);
+ }
+
public void setMenuClickListener(OnMenuEventListener listener);
public void setAppName(String appName);
diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
index 62b0542..de64cf8 100644
--- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
+++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
@@ -176,10 +176,6 @@
setClipChildren(false);
setClipToPadding(false);
Dependency.get(ConfigurationController.class).observe(viewAttachLifecycle(this), this);
-
- // Needed for PorderDuff.Mode.CLEAR operations to work properly, but redraws don't happen
- // enough to justify a hardware layer.
- setLayerType(LAYER_TYPE_SOFTWARE, null);
}
private void setupLayoutTransition() {
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
index 60e6083..f7ecfd7 100644
--- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
@@ -265,7 +265,9 @@
public boolean onInterceptTouchEvent(final MotionEvent ev) {
if (mCurrView instanceof ExpandableNotificationRow) {
NotificationMenuRowPlugin nmr = ((ExpandableNotificationRow) mCurrView).getProvider();
- mMenuRowIntercepting = nmr.onInterceptTouchEvent(mCurrView, ev);
+ if (nmr != null) {
+ mMenuRowIntercepting = nmr.onInterceptTouchEvent(mCurrView, ev);
+ }
}
final int action = ev.getAction();
@@ -487,6 +489,7 @@
mSnappingChild = false;
if (!wasCancelled) {
updateSwipeProgressFromOffset(animView, canBeDismissed);
+ onChildSnappedBack(animView, targetLeft);
mCallback.onChildSnappedBack(animView, targetLeft);
}
}
@@ -500,6 +503,13 @@
}
/**
+ * Give the swipe helper itself a chance to do something on snap back so NSSL doesn't have
+ * to tell us what to do
+ */
+ protected void onChildSnappedBack(View animView, float targetLeft) {
+ }
+
+ /**
* Called to update the snap back animation.
*/
protected void prepareSnapBackAnimation(View view, Animator anim) {
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index de4605b..d850dbc 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -64,6 +64,8 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
+import java.util.Collections;
+import java.util.List;
/**
* Renders bubbles in a stack and handles animating expanded and collapsed states.
@@ -164,6 +166,8 @@
int[] mTempLoc = new int[2];
RectF mTempRect = new RectF();
+ private final List<Rect> mSystemGestureExclusionRects = Collections.singletonList(new Rect());
+
private ViewTreeObserver.OnPreDrawListener mViewUpdater =
new ViewTreeObserver.OnPreDrawListener() {
@Override
@@ -175,6 +179,9 @@
}
};
+ private ViewTreeObserver.OnDrawListener mSystemGestureExcludeUpdater =
+ this::updateSystemGestureExcludeRects;
+
private ViewClippingUtil.ClippingParameters mClippingParameters =
new ViewClippingUtil.ClippingParameters() {
@@ -361,6 +368,19 @@
return false;
}
+ private void updateSystemGestureExcludeRects() {
+ // Exclude the region occupied by the first BubbleView in the stack
+ Rect excludeZone = mSystemGestureExclusionRects.get(0);
+ if (mBubbleContainer.getChildCount() > 0) {
+ View firstBubble = mBubbleContainer.getChildAt(0);
+ excludeZone.set(firstBubble.getLeft(), firstBubble.getTop(), firstBubble.getRight(),
+ firstBubble.getBottom());
+ } else {
+ excludeZone.setEmpty();
+ }
+ mBubbleContainer.setSystemGestureExclusionRects(mSystemGestureExclusionRects);
+ }
+
/**
* Updates the visibility of the 'dot' indicating an update on the bubble.
* @param key the {@link NotificationEntry#key} associated with the bubble.
@@ -669,12 +689,17 @@
updateExpandedBubble();
applyCurrentState();
+ // This must be a separate OnDrawListener since it should be called for every draw.
+ getViewTreeObserver().addOnDrawListener(mSystemGestureExcludeUpdater);
+
mIsExpansionAnimating = true;
Runnable updateAfter = () -> {
applyCurrentState();
mIsExpansionAnimating = false;
requestUpdate();
+ getViewTreeObserver().removeOnDrawListener(mSystemGestureExcludeUpdater);
+ updateSystemGestureExcludeRects();
};
if (shouldExpand) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
index d287b92..efdcd05 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
@@ -1147,10 +1147,13 @@
@Override
public void onPluginConnected(NotificationMenuRowPlugin plugin, Context pluginContext) {
- boolean existed = mMenuRow.getMenuView() != null;
+ boolean existed = mMenuRow != null && mMenuRow.getMenuView() != null;
if (existed) {
removeView(mMenuRow.getMenuView());
}
+ if (plugin == null) {
+ return;
+ }
mMenuRow = plugin;
if (mMenuRow.shouldUseDefaultMenuItems()) {
ArrayList<MenuItem> items = new ArrayList<>();
@@ -1173,7 +1176,18 @@
}
}
+ /**
+ * Get a handle to a NotificationMenuRowPlugin whose menu view has been added to our hierarchy,
+ * or null if there is no menu row
+ *
+ * @return a {@link NotificationMenuRowPlugin}, or null
+ */
+ @Nullable
public NotificationMenuRowPlugin createMenu() {
+ if (mMenuRow == null) {
+ return null;
+ }
+
if (mMenuRow.getMenuView() == null) {
mMenuRow.createMenu(this, mStatusBarNotification);
mMenuRow.setAppName(mAppName);
@@ -1184,6 +1198,7 @@
return mMenuRow;
}
+ @Nullable
public NotificationMenuRowPlugin getProvider() {
return mMenuRow;
}
@@ -1211,7 +1226,7 @@
mGuts.setVisibility(oldGuts.getVisibility());
addView(mGuts, index);
}
- View oldMenu = mMenuRow.getMenuView();
+ View oldMenu = mMenuRow == null ? null : mMenuRow.getMenuView();
if (oldMenu != null) {
int menuIndex = indexOfChild(oldMenu);
removeView(oldMenu);
@@ -1230,7 +1245,7 @@
@Override
public void onConfigurationChanged(Configuration newConfig) {
- if (mMenuRow.getMenuView() != null) {
+ if (mMenuRow != null && mMenuRow.getMenuView() != null) {
mMenuRow.onConfigurationChanged();
}
}
@@ -1728,7 +1743,11 @@
public void setAppOpsOnClickListener(ExpandableNotificationRow.OnAppOpsClickListener l) {
mOnAppOpsClickListener = v -> {
createMenu();
- MenuItem menuItem = getProvider().getAppOpsMenuItem(mContext);
+ NotificationMenuRowPlugin provider = getProvider();
+ if (provider == null) {
+ return;
+ }
+ MenuItem menuItem = provider.getAppOpsMenuItem(mContext);
if (menuItem != null) {
l.onClick(this, v.getWidth() / 2, v.getHeight() / 2, menuItem);
}
@@ -1790,7 +1809,11 @@
public void doLongClickCallback(int x, int y) {
createMenu();
- MenuItem menuItem = getProvider().getLongpressMenuItem(mContext);
+ NotificationMenuRowPlugin provider = getProvider();
+ MenuItem menuItem = null;
+ if (provider != null) {
+ menuItem = provider.getLongpressMenuItem(mContext);
+ }
doLongClickCallback(x, y, menuItem);
}
@@ -1844,7 +1867,9 @@
getEntry().expandedIcon.setScrollX(0);
}
- mMenuRow.resetMenu();
+ if (mMenuRow != null) {
+ mMenuRow.resetMenu();
+ }
}
void onGutsOpened() {
@@ -1921,7 +1946,7 @@
getEntry().expandedIcon.setScrollX((int) -translationX);
}
- if (mMenuRow.getMenuView() != null) {
+ if (mMenuRow != null && mMenuRow.getMenuView() != null) {
mMenuRow.onParentTranslationUpdate(translationX);
}
}
@@ -1973,7 +1998,9 @@
mNotificationTranslationFinished = true;
}
if (!cancelled && leftTarget == 0) {
- mMenuRow.resetMenu();
+ if (mMenuRow != null) {
+ mMenuRow.resetMenu();
+ }
mTranslateAnim = null;
}
}
@@ -1982,7 +2009,7 @@
return translateAnim;
}
- public void inflateGuts() {
+ void ensureGutsInflated() {
if (mGuts == null) {
mGutsStub.inflate();
}
@@ -2438,7 +2465,7 @@
if (intrinsicBefore != getIntrinsicHeight() && intrinsicBefore != 0) {
notifyHeightChanged(true /* needsAnimation */);
}
- if (mMenuRow.getMenuView() != null) {
+ if (mMenuRow != null && mMenuRow.getMenuView() != null) {
mMenuRow.onParentHeightUpdate();
}
updateContentShiftHeight();
@@ -2641,7 +2668,7 @@
public long performRemoveAnimation(long duration, long delay, float translationDirection,
boolean isHeadsUpAnimation, float endLocation, Runnable onFinishedRunnable,
AnimatorListenerAdapter animationListener) {
- if (mMenuRow.isMenuVisible()) {
+ if (mMenuRow != null && mMenuRow.isMenuVisible()) {
Animator anim = getTranslateViewAnimator(0f, null /* listener */);
if (anim != null) {
anim.addListener(new AnimatorListenerAdapter() {
@@ -2712,7 +2739,7 @@
if (mGuts != null) {
mGuts.setActualHeight(height);
}
- if (mMenuRow.getMenuView() != null) {
+ if (mMenuRow != null && mMenuRow.getMenuView() != null) {
mMenuRow.onParentHeightUpdate();
}
}
@@ -2977,8 +3004,10 @@
default:
if (action == R.id.action_snooze) {
NotificationMenuRowPlugin provider = getProvider();
- if (provider == null) {
+ if (provider == null && mMenuRow != null) {
provider = createMenu();
+ } else {
+ return false;
}
MenuItem snoozeMenu = provider.getSnoozeMenuItem(getContext());
if (snoozeMenu != null) {
@@ -3109,7 +3138,9 @@
/** Sets whether dismiss gestures are right-to-left (instead of left-to-right). */
public void setDismissRtl(boolean dismissRtl) {
- mMenuRow.setDismissRtl(dismissRtl);
+ if (mMenuRow != null) {
+ mMenuRow.setDismissRtl(dismissRtl);
+ }
}
private static class NotificationViewState extends ExpandableViewState {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGuts.java
index fbe9c5d..4700baa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGuts.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGuts.java
@@ -114,7 +114,7 @@
public void onHeightChanged(NotificationGuts guts);
}
- interface OnSettingsClickListener {
+ private interface OnSettingsClickListener {
void onClick(View v, int appUid);
}
@@ -271,6 +271,8 @@
double horz = Math.max(getWidth() - x, x);
double vert = Math.max(getHeight() - y, y);
float r = (float) Math.hypot(horz, vert);
+ // Make sure we'll be visible after the circular reveal
+ setAlpha(1f);
// Circular reveal originating at (x, y)
Animator a = ViewAnimationUtils.createCircularReveal(this, x, y, 0, r);
a.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
index 69e6120..faa7898 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
@@ -165,8 +165,8 @@
}
}
- public boolean bindGuts(final ExpandableNotificationRow row) {
- row.inflateGuts();
+ private boolean bindGuts(final ExpandableNotificationRow row) {
+ row.ensureGutsInflated();
return bindGuts(row, mGutsMenuItem);
}
@@ -386,7 +386,7 @@
return false;
}
- row.inflateGuts();
+ row.ensureGutsInflated();
NotificationGuts guts = row.getGuts();
mNotificationGutsExposed = guts;
if (!bindGuts(row, menuItem)) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java
index d83a158..ef7d20c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java
@@ -25,6 +25,7 @@
import android.app.Notification;
import android.content.Context;
import android.content.res.Resources;
+import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Looper;
@@ -79,6 +80,7 @@
private OnMenuEventListener mMenuListener;
private boolean mDismissRtl;
private boolean mIsForeground;
+ private final boolean mIsUsingNewInterruptionModel;
private ValueAnimator mFadeAnimator;
private boolean mAnimating;
@@ -116,6 +118,7 @@
mHandler = new Handler(Looper.getMainLooper());
mLeftMenuItems = new ArrayList<>();
mRightMenuItems = new ArrayList<>();
+ mIsUsingNewInterruptionModel = NotificationUtils.useNewInterruptionModel(mContext);
}
@Override
@@ -252,13 +255,13 @@
mSnoozeItem = createSnoozeItem(mContext);
}
mAppOpsItem = createAppOpsItem(mContext);
- if (NotificationUtils.useNewInterruptionModel(mContext)) {
+ if (mIsUsingNewInterruptionModel) {
mInfoItem = createInfoItem(mContext, !mParent.getEntry().isHighPriority());
} else {
mInfoItem = createInfoItem(mContext);
}
- if (!NotificationUtils.useNewInterruptionModel(mContext)) {
+ if (!mIsUsingNewInterruptionModel) {
if (!isForeground) {
mRightMenuItems.add(mSnoozeItem);
}
@@ -268,10 +271,6 @@
} else {
ArrayList<MenuItem> menuItems = mDismissRtl ? mLeftMenuItems : mRightMenuItems;
menuItems.add(mInfoItem);
- menuItems.add(mAppOpsItem);
- if (!isForeground) {
- menuItems.add(mSnoozeItem);
- }
}
populateMenuViews();
@@ -617,6 +616,29 @@
// TODO -- handle / allow custom menu items!
}
+ @Override
+ public boolean shouldShowGutsOnSnapOpen() {
+ return mIsUsingNewInterruptionModel;
+ }
+
+ @Override
+ public MenuItem menuItemToExposeOnSnap() {
+ return mIsUsingNewInterruptionModel ? mInfoItem : null;
+ }
+
+ @Override
+ public Point getRevealAnimationOrigin() {
+ View v = mInfoItem.getMenuView();
+ int menuX = v.getLeft() + v.getPaddingLeft() + (v.getWidth() / 2);
+ int menuY = v.getTop() + v.getPaddingTop() + (v.getHeight() / 2);
+ if (isMenuOnLeft()) {
+ return new Point(menuX, menuY);
+ } else {
+ menuX = mParent.getRight() - menuX;
+ return new Point(menuX, menuY);
+ }
+ }
+
static MenuItem createSnoozeItem(Context context) {
Resources res = context.getResources();
NotificationSnooze content = (NotificationSnooze) LayoutInflater.from(context)
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 bbb17c2..d11eab7 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
@@ -38,6 +38,7 @@
import android.graphics.Color;
import android.graphics.Outline;
import android.graphics.Paint;
+import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
@@ -1691,8 +1692,10 @@
ExpandableNotificationRow child = entry.getRow();
boolean animate = mIsExpanded || isPinnedHeadsUp(child);
// If the child is showing the notification menu snap to that
- float targetLeft = child.getProvider().isMenuVisible() ? child.getTranslation() : 0;
- mSwipeHelper.snapChildIfNeeded(child, animate, targetLeft);
+ if (child.getProvider() != null) {
+ float targetLeft = child.getProvider().isMenuVisible() ? child.getTranslation() : 0;
+ mSwipeHelper.snapChildIfNeeded(child, animate, targetLeft);
+ }
}
@Override
@@ -6143,8 +6146,24 @@
.setCategory(MetricsEvent.ACTION_REVEAL_GEAR)
.setType(MetricsEvent.TYPE_ACTION));
mHeadsUpManager.setMenuShown(notificationRow.getEntry(), true);
+ mSwipeHelper.onMenuShown(row);
+
+ // Check to see if we want to go directly to the notfication guts
+ NotificationMenuRowPlugin provider = notificationRow.getProvider();
+ if (provider.shouldShowGutsOnSnapOpen()) {
+ MenuItem item = provider.menuItemToExposeOnSnap();
+ if (item != null) {
+ Point origin = provider.getRevealAnimationOrigin();
+ mGutsManager.openGuts(row, origin.x, origin.y, item);
+ } else {
+ Log.e(TAG, "Provider has shouldShowGutsOnSnapOpen, but provided no "
+ + "menu item in menuItemtoExposeOnSnap. Skipping.");
+ }
+
+ // Close the menu row since we went directly to the guts
+ resetExposedMenuView(false, true);
+ }
}
- mSwipeHelper.onMenuShown(row);
}
};
@@ -6275,11 +6294,6 @@
mAmbientState.onDragFinished(animView);
updateContinuousShadowDrawing();
updateContinuousBackgroundDrawing();
- NotificationMenuRowPlugin menuRow = mSwipeHelper.getCurrentMenuRow();
- if (menuRow != null && targetLeft == 0) {
- menuRow.resetMenu();
- mSwipeHelper.clearCurrentMenuRow();
- }
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java
index 478427c..4569b66 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java
@@ -93,7 +93,17 @@
protected Handler getHandler() { return mHandler; }
@VisibleForTesting
- protected Runnable getFalsingCheck() { return mFalsingCheck; };
+ protected Runnable getFalsingCheck() {
+ return mFalsingCheck;
+ }
+
+ @Override
+ protected void onChildSnappedBack(View animView, float targetLeft) {
+ if (mCurrMenuRow != null && targetLeft == 0) {
+ mCurrMenuRow.resetMenu();
+ clearCurrentMenuRow();
+ }
+ }
@Override
public void onDownUpdate(View currView, MotionEvent ev) {
@@ -117,8 +127,10 @@
protected void initializeRow(ExpandableNotificationRow row) {
if (row.getEntry().hasFinishedInitialization()) {
mCurrMenuRow = row.createMenu();
- mCurrMenuRow.setMenuClickListener(mMenuListener);
- mCurrMenuRow.onTouchStart();
+ if (mCurrMenuRow != null) {
+ mCurrMenuRow.setMenuClickListener(mMenuListener);
+ mCurrMenuRow.onTouchStart();
+ }
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
index 8380192..5f0839d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
@@ -186,7 +186,7 @@
when(row.getWindowToken()).thenReturn(new Binder());
when(row.getGuts()).thenReturn(guts);
- doNothing().when(row).inflateGuts();
+ doNothing().when(row).ensureGutsInflated();
NotificationEntry realEntry = realRow.getEntry();
NotificationEntry entry = spy(realEntry);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java
index e6389c4..c62a802 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java
@@ -14,6 +14,8 @@
package com.android.systemui.statusbar.notification.row;
+import static android.provider.Settings.Secure.NOTIFICATION_NEW_INTERRUPTION_MODEL;
+
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
@@ -26,6 +28,7 @@
import static org.mockito.Mockito.when;
import android.app.NotificationChannel;
+import android.provider.Settings;
import android.service.notification.StatusBarNotification;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
@@ -39,6 +42,7 @@
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.utils.leaks.LeakCheckedTest;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -61,6 +65,13 @@
when(mRow.getEntry()).thenReturn(entry);
}
+ @After
+ public void tearDown() {
+ Settings.Secure.putInt(mContext.getContentResolver(),
+ NOTIFICATION_NEW_INTERRUPTION_MODEL, 0);
+ }
+
+
@Test
public void testAttachDetach() {
NotificationMenuRowPlugin row = new NotificationMenuRow(mContext);
@@ -89,6 +100,9 @@
@Test
public void testNoAppOpsInSlowSwipe() {
+ Settings.Secure.putInt(mContext.getContentResolver(),
+ NOTIFICATION_NEW_INTERRUPTION_MODEL, 0);
+
NotificationMenuRow row = new NotificationMenuRow(mContext);
row.createMenu(mRow, null);
@@ -98,6 +112,19 @@
}
@Test
+ public void testNoAppOpsInSlowSwipe_newInterruptionModel() {
+ Settings.Secure.putInt(mContext.getContentResolver(),
+ NOTIFICATION_NEW_INTERRUPTION_MODEL, 1);
+
+ NotificationMenuRow row = new NotificationMenuRow(mContext);
+ row.createMenu(mRow, null);
+
+ ViewGroup container = (ViewGroup) row.getMenuView();
+ // in the new interruption model there is only the blocking item
+ assertEquals(1, container.getChildCount());
+ }
+
+ @Test
public void testIsSnappedAndOnSameSide() {
NotificationMenuRow row = Mockito.spy(new NotificationMenuRow((mContext)));
diff --git a/services/core/java/com/android/server/DynamicSystemService.java b/services/core/java/com/android/server/DynamicSystemService.java
index 99bbcf8..7a1697f 100644
--- a/services/core/java/com/android/server/DynamicSystemService.java
+++ b/services/core/java/com/android/server/DynamicSystemService.java
@@ -18,16 +18,23 @@
import android.content.Context;
import android.content.pm.PackageManager;
+import android.gsi.GsiInstallParams;
import android.gsi.GsiProgress;
import android.gsi.IGsiService;
+import android.os.Environment;
import android.os.IBinder;
import android.os.IBinder.DeathRecipient;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
+import android.os.UserHandle;
import android.os.image.IDynamicSystemService;
+import android.os.storage.StorageManager;
+import android.os.storage.StorageVolume;
import android.util.Slog;
+import java.io.File;
+
/**
* DynamicSystemService implements IDynamicSystemService. It provides permission check before
* passing requests to gsid
@@ -36,7 +43,7 @@
private static final String TAG = "DynamicSystemService";
private static final String NO_SERVICE_ERROR = "no gsiservice";
private static final int GSID_ROUGH_TIMEOUT_MS = 8192;
-
+ private static final String PATH_DEFAULT = "/data/gsi";
private Context mContext;
private volatile IGsiService mGsiService;
@@ -100,7 +107,32 @@
@Override
public boolean startInstallation(long systemSize, long userdataSize) throws RemoteException {
- return getGsiService().startGsiInstall(systemSize, userdataSize, true) == 0;
+ // priority from high to low: sysprop -> sdcard -> /data
+ String path = SystemProperties.get("os.aot.path");
+ if (path.isEmpty()) {
+ final int userId = UserHandle.myUserId();
+ final StorageVolume[] volumes =
+ StorageManager.getVolumeList(userId, StorageManager.FLAG_FOR_WRITE);
+ for (StorageVolume volume : volumes) {
+ if (volume.isEmulated()) continue;
+ if (!volume.isRemovable()) continue;
+ if (!Environment.MEDIA_MOUNTED.equals(volume.getState())) continue;
+ File sdCard = volume.getPathFile();
+ if (sdCard.isDirectory()) {
+ path = sdCard.getPath();
+ break;
+ }
+ }
+ if (path.isEmpty()) {
+ path = PATH_DEFAULT;
+ }
+ Slog.i(TAG, "startInstallation -> " + path);
+ }
+ GsiInstallParams installParams = new GsiInstallParams();
+ installParams.installDir = path;
+ installParams.gsiSize = systemSize;
+ installParams.userdataSize = userdataSize;
+ return getGsiService().beginGsiInstall(installParams) == 0;
}
@Override
diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java
index f86ba27..ae3324c 100644
--- a/services/core/java/com/android/server/am/BatteryStatsService.java
+++ b/services/core/java/com/android/server/am/BatteryStatsService.java
@@ -720,10 +720,10 @@
}
}
- public void notePhoneDataConnectionState(int dataType, boolean hasData) {
+ public void notePhoneDataConnectionState(int dataType, boolean hasData, int serviceType) {
enforceCallingPermission();
synchronized (mStats) {
- mStats.notePhoneDataConnectionStateLocked(dataType, hasData);
+ mStats.notePhoneDataConnectionStateLocked(dataType, hasData, serviceType);
}
}
diff --git a/services/core/java/com/android/server/biometrics/BiometricService.java b/services/core/java/com/android/server/biometrics/BiometricService.java
index 516844d..a64eacb 100644
--- a/services/core/java/com/android/server/biometrics/BiometricService.java
+++ b/services/core/java/com/android/server/biometrics/BiometricService.java
@@ -19,7 +19,6 @@
import static android.Manifest.permission.USE_BIOMETRIC;
import static android.Manifest.permission.USE_BIOMETRIC_INTERNAL;
import static android.Manifest.permission.USE_FINGERPRINT;
-import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND;
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT;
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_IRIS;
@@ -576,30 +575,9 @@
if (useDefaultTitle) {
checkInternalPermission();
// Set the default title if necessary
- try {
- final List<ActivityManager.RunningAppProcessInfo> procs =
- ActivityManager.getService().getRunningAppProcesses();
- for (int i = 0; i < procs.size(); i++) {
- final ActivityManager.RunningAppProcessInfo info = procs.get(i);
- if (info.uid == callingUid
- && info.importance == IMPORTANCE_FOREGROUND) {
- PackageManager pm = getContext().getPackageManager();
- final CharSequence label = pm.getApplicationLabel(
- pm.getApplicationInfo(info.processName,
- PackageManager.GET_META_DATA));
- final String title = getContext()
- .getString(R.string.biometric_dialog_default_title, label);
- if (TextUtils.isEmpty(
- bundle.getCharSequence(BiometricPrompt.KEY_TITLE))) {
- bundle.putCharSequence(BiometricPrompt.KEY_TITLE, title);
- }
- break;
- }
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "Remote exception", e);
- } catch (PackageManager.NameNotFoundException e) {
- Slog.e(TAG, "Name not found", e);
+ if (TextUtils.isEmpty(bundle.getCharSequence(BiometricPrompt.KEY_TITLE))) {
+ bundle.putCharSequence(BiometricPrompt.KEY_TITLE,
+ getContext().getString(R.string.biometric_dialog_default_title));
}
}
diff --git a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java
index d8e7b7d..c4855c3 100644
--- a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java
+++ b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java
@@ -1045,10 +1045,15 @@
}
} else {
currentClient.stop(initiatedByClient);
+
+ // Only post the reset runnable for non-cleanup clients. Cleanup clients should
+ // never be forcibly stopped since they ensure synchronization between HAL and
+ // framework. Thus, we should instead just start the pending client once cleanup
+ // finishes instead of using the reset runnable.
+ mHandler.removeCallbacks(mResetClientState);
+ mHandler.postDelayed(mResetClientState, CANCEL_TIMEOUT_LIMIT);
}
mPendingClient = newClient;
- mHandler.removeCallbacks(mResetClientState);
- mHandler.postDelayed(mResetClientState, CANCEL_TIMEOUT_LIMIT);
} else if (newClient != null) {
// For BiometricPrompt clients, do not start until
// <Biometric>Service#startPreparedClient is called. BiometricService waits until all
@@ -1225,6 +1230,7 @@
} else {
clearEnumerateState();
if (mPendingClient != null) {
+ Slog.d(getTag(), "Enumerate finished, starting pending client");
startClient(mPendingClient, false /* initiatedByClient */);
}
}
diff --git a/services/core/java/com/android/server/connectivity/DataConnectionStats.java b/services/core/java/com/android/server/connectivity/DataConnectionStats.java
index 227ab23..4990ea1 100644
--- a/services/core/java/com/android/server/connectivity/DataConnectionStats.java
+++ b/services/core/java/com/android/server/connectivity/DataConnectionStats.java
@@ -91,7 +91,8 @@
if (DEBUG) Log.d(TAG, String.format("Noting data connection for network type %s: %svisible",
networkType, visible ? "" : "not "));
try {
- mBatteryStats.notePhoneDataConnectionState(networkType, visible);
+ mBatteryStats.notePhoneDataConnectionState(networkType, visible,
+ mServiceState.getState());
} catch (RemoteException e) {
Log.w(TAG, "Error noting data connection state", e);
}
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
index e2ea42e..5fb67dd 100644
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
@@ -572,9 +572,6 @@
public void onSwitchUser(@UserIdInt int newUserId) {
handleSettingsChange(true /* userSwitch */);
mBrightnessTracker.onSwitchUser(newUserId);
- if (mDisplayWhiteBalanceSettings != null) {
- mDisplayWhiteBalanceSettings.onSwitchUser();
- }
}
public ParceledListSlice<AmbientBrightnessDayStats> getAmbientBrightnessStats(
diff --git a/services/core/java/com/android/server/display/color/ColorDisplayService.java b/services/core/java/com/android/server/display/color/ColorDisplayService.java
index 4f81c03..9590f81 100644
--- a/services/core/java/com/android/server/display/color/ColorDisplayService.java
+++ b/services/core/java/com/android/server/display/color/ColorDisplayService.java
@@ -105,10 +105,12 @@
*/
private static final long TRANSITION_DURATION = 3000L;
- private static final int MSG_APPLY_NIGHT_DISPLAY_IMMEDIATE = 0;
- private static final int MSG_APPLY_NIGHT_DISPLAY_ANIMATED = 1;
- private static final int MSG_APPLY_GLOBAL_SATURATION = 2;
- private static final int MSG_APPLY_DISPLAY_WHITE_BALANCE = 3;
+ private static final int MSG_USER_CHANGED = 0;
+ private static final int MSG_SET_UP = 1;
+ private static final int MSG_APPLY_NIGHT_DISPLAY_IMMEDIATE = 2;
+ private static final int MSG_APPLY_NIGHT_DISPLAY_ANIMATED = 3;
+ private static final int MSG_APPLY_GLOBAL_SATURATION = 4;
+ private static final int MSG_APPLY_DISPLAY_WHITE_BALANCE = 5;
/**
* Return value if a setting has not been set.
@@ -186,7 +188,7 @@
// Register listeners now that boot is complete.
if (mCurrentUser != UserHandle.USER_NULL && mUserSetupObserver == null) {
- setUp();
+ mHandler.sendEmptyMessage(MSG_SET_UP);
}
}
}
@@ -196,7 +198,9 @@
super.onStartUser(userHandle);
if (mCurrentUser == UserHandle.USER_NULL) {
- onUserChanged(userHandle);
+ final Message message = mHandler.obtainMessage(MSG_USER_CHANGED);
+ message.arg1 = userHandle;
+ mHandler.sendMessage(message);
}
}
@@ -204,7 +208,9 @@
public void onSwitchUser(int userHandle) {
super.onSwitchUser(userHandle);
- onUserChanged(userHandle);
+ final Message message = mHandler.obtainMessage(MSG_USER_CHANGED);
+ message.arg1 = userHandle;
+ mHandler.sendMessage(message);
}
@Override
@@ -212,7 +218,9 @@
super.onStopUser(userHandle);
if (mCurrentUser == userHandle) {
- onUserChanged(UserHandle.USER_NULL);
+ final Message message = mHandler.obtainMessage(MSG_USER_CHANGED);
+ message.arg1 = UserHandle.USER_NULL;
+ mHandler.sendMessage(message);
}
}
@@ -262,7 +270,7 @@
// Listen for external changes to any of the settings.
if (mContentObserver == null) {
- mContentObserver = new ContentObserver(new Handler(DisplayThread.get().getLooper())) {
+ mContentObserver = new ContentObserver(mHandler) {
@Override
public void onChange(boolean selfChange, Uri uri) {
super.onChange(selfChange, uri);
@@ -467,6 +475,9 @@
* Apply the accessibility daltonizer transform based on the settings value.
*/
private void onAccessibilityDaltonizerChanged() {
+ if (mCurrentUser == UserHandle.USER_NULL) {
+ return;
+ }
final boolean enabled = Secure.getIntForUser(getContext().getContentResolver(),
Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0, mCurrentUser) != 0;
final int daltonizerMode = enabled ? Secure.getIntForUser(getContext().getContentResolver(),
@@ -490,6 +501,9 @@
* Apply the accessibility inversion transform based on the settings value.
*/
private void onAccessibilityInversionChanged() {
+ if (mCurrentUser == UserHandle.USER_NULL) {
+ return;
+ }
final boolean enabled = Secure.getIntForUser(getContext().getContentResolver(),
Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 0, mCurrentUser) != 0;
final DisplayTransformManager dtm = getLocalService(DisplayTransformManager.class);
@@ -596,7 +610,19 @@
}
}
+ private boolean setDisplayWhiteBalanceSettingEnabled(boolean enabled) {
+ if (mCurrentUser == UserHandle.USER_NULL) {
+ return false;
+ }
+ return Secure.putIntForUser(getContext().getContentResolver(),
+ Secure.DISPLAY_WHITE_BALANCE_ENABLED,
+ enabled ? 1 : 0, mCurrentUser);
+ }
+
private boolean isDisplayWhiteBalanceSettingEnabled() {
+ if (mCurrentUser == UserHandle.USER_NULL) {
+ return false;
+ }
return Secure.getIntForUser(getContext().getContentResolver(),
Secure.DISPLAY_WHITE_BALANCE_ENABLED, 0, mCurrentUser) == 1;
}
@@ -648,6 +674,9 @@
}
private int getNightDisplayAutoModeRawInternal() {
+ if (mCurrentUser == UserHandle.USER_NULL) {
+ return NOT_SET;
+ }
return Secure
.getIntForUser(getContext().getContentResolver(), Secure.NIGHT_DISPLAY_AUTO_MODE,
NOT_SET, mCurrentUser);
@@ -1214,6 +1243,13 @@
}
/**
+ * Returns whether Display white balance is currently enabled.
+ */
+ public boolean isDisplayWhiteBalanceEnabled() {
+ return isDisplayWhiteBalanceSettingEnabled();
+ }
+
+ /**
* Adds a {@link WeakReference<ColorTransformController>} for a newly started activity, and
* invokes {@link ColorTransformController#applyAppSaturation(float[], float[])} if needed.
*/
@@ -1233,7 +1269,7 @@
* Notify that the display white balance status has changed, either due to preemption by
* another transform or the feature being turned off.
*/
- void onDisplayWhiteBalanceStatusChanged(boolean enabled);
+ void onDisplayWhiteBalanceStatusChanged(boolean activated);
}
private final class TintHandler extends Handler {
@@ -1245,6 +1281,12 @@
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
+ case MSG_USER_CHANGED:
+ onUserChanged(msg.arg1);
+ break;
+ case MSG_SET_UP:
+ setUp();
+ break;
case MSG_APPLY_GLOBAL_SATURATION:
mGlobalSaturationTintController.setMatrix(msg.arg1);
applyTint(mGlobalSaturationTintController, false);
@@ -1500,6 +1542,29 @@
}
@Override
+ public boolean setDisplayWhiteBalanceEnabled(boolean enabled) {
+ getContext().enforceCallingOrSelfPermission(
+ Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS,
+ "Permission required to set night display activated");
+ final long token = Binder.clearCallingIdentity();
+ try {
+ return setDisplayWhiteBalanceSettingEnabled(enabled);
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ @Override
+ public boolean isDisplayWhiteBalanceEnabled() {
+ final long token = Binder.clearCallingIdentity();
+ try {
+ return isDisplayWhiteBalanceSettingEnabled();
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ @Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (!DumpUtils.checkDumpPermission(getContext(), TAG, pw)) {
return;
diff --git a/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceSettings.java b/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceSettings.java
index 1b7251c..6e78894 100644
--- a/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceSettings.java
+++ b/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceSettings.java
@@ -18,13 +18,9 @@
import android.annotation.NonNull;
import android.content.Context;
-import android.database.ContentObserver;
-import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
-import android.os.UserHandle;
-import android.provider.Settings.Secure;
import android.util.Slog;
import com.android.internal.util.Preconditions;
@@ -46,22 +42,19 @@
protected static final String TAG = "DisplayWhiteBalanceSettings";
protected boolean mLoggingEnabled;
- private static final String SETTING_URI = Secure.DISPLAY_WHITE_BALANCE_ENABLED;
- private static final int SETTING_DEFAULT = 0;
- private static final int SETTING_ENABLED = 1;
-
private static final int MSG_SET_ACTIVE = 1;
private final Context mContext;
private final Handler mHandler;
- private final SettingsObserver mSettingsObserver;
+
+ private final ColorDisplayServiceInternal mCdsi;
// To decouple the DisplayPowerController from the DisplayWhiteBalanceSettings, the DPC
// implements Callbacks and passes itself to the DWBS so it can call back into it without
// knowing about it.
private Callbacks mCallbacks;
- private int mSetting;
+ private boolean mEnabled;
private boolean mActive;
/**
@@ -79,18 +72,12 @@
mLoggingEnabled = false;
mContext = context;
mHandler = new DisplayWhiteBalanceSettingsHandler(handler.getLooper());
- mSettingsObserver = new SettingsObserver(mHandler);
- mSetting = getSetting();
- mActive = false;
mCallbacks = null;
- mContext.getContentResolver().registerContentObserver(
- Secure.getUriFor(SETTING_URI), false /* notifyForDescendants */, mSettingsObserver,
- UserHandle.USER_ALL);
-
- ColorDisplayServiceInternal cds =
- LocalServices.getService(ColorDisplayServiceInternal.class);
- cds.setDisplayWhiteBalanceListener(this);
+ mCdsi = LocalServices.getService(ColorDisplayServiceInternal.class);
+ setEnabled(mCdsi.isDisplayWhiteBalanceEnabled());
+ final boolean isActive = mCdsi.setDisplayWhiteBalanceListener(this);
+ setActive(isActive);
}
/**
@@ -99,7 +86,7 @@
* @param callbacks
* The object to call back to.
*
- * @return Whether the method suceeded or not.
+ * @return Whether the method succeeded or not.
*/
public boolean setCallbacks(Callbacks callbacks) {
if (mCallbacks == callbacks) {
@@ -131,14 +118,7 @@
* @return Whether display white-balance is enabled.
*/
public boolean isEnabled() {
- return (mSetting == SETTING_ENABLED) && mActive;
- }
-
- /**
- * Re-evaluate state after switching to a new user.
- */
- public void onSwitchUser() {
- handleSettingChange();
+ return mEnabled && mActive;
}
/**
@@ -152,15 +132,14 @@
writer.println(" mLoggingEnabled=" + mLoggingEnabled);
writer.println(" mContext=" + mContext);
writer.println(" mHandler=" + mHandler);
- writer.println(" mSettingsObserver=" + mSettingsObserver);
- writer.println(" mSetting=" + mSetting);
+ writer.println(" mEnabled=" + mEnabled);
writer.println(" mActive=" + mActive);
writer.println(" mCallbacks=" + mCallbacks);
}
@Override
- public void onDisplayWhiteBalanceStatusChanged(boolean active) {
- Message msg = mHandler.obtainMessage(MSG_SET_ACTIVE, active ? 1 : 0, 0);
+ public void onDisplayWhiteBalanceStatusChanged(boolean activated) {
+ Message msg = mHandler.obtainMessage(MSG_SET_ACTIVE, activated ? 1 : 0, 0);
msg.sendToTarget();
}
@@ -169,20 +148,14 @@
Preconditions.checkNotNull(handler, "handler must not be null");
}
- private int getSetting() {
- return Secure.getIntForUser(mContext.getContentResolver(), SETTING_URI, SETTING_DEFAULT,
- UserHandle.USER_CURRENT);
- }
-
- private void handleSettingChange() {
- final int setting = getSetting();
- if (mSetting == setting) {
+ private void setEnabled(boolean enabled) {
+ if (mEnabled == enabled) {
return;
}
if (mLoggingEnabled) {
- Slog.d(TAG, "Setting: " + setting);
+ Slog.d(TAG, "Setting: " + enabled);
}
- mSetting = setting;
+ mEnabled = enabled;
if (mCallbacks != null) {
mCallbacks.updateWhiteBalance();
}
@@ -201,17 +174,6 @@
}
}
- private final class SettingsObserver extends ContentObserver {
- SettingsObserver(Handler handler) {
- super(handler);
- }
-
- @Override
- public void onChange(boolean selfChange, Uri uri) {
- handleSettingChange();
- }
- }
-
private final class DisplayWhiteBalanceSettingsHandler extends Handler {
DisplayWhiteBalanceSettingsHandler(Looper looper) {
super(looper, null, true /* async */);
@@ -222,6 +184,7 @@
switch (msg.what) {
case MSG_SET_ACTIVE:
setActive(msg.arg1 != 0);
+ setEnabled(mCdsi.isDisplayWhiteBalanceEnabled());
break;
}
}
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index b64abdb..10ae782 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -224,6 +224,7 @@
import android.view.RemoteAnimationAdapter;
import android.view.RemoteAnimationDefinition;
import android.view.WindowManager;
+import android.view.inputmethod.InputMethodSystemProperty;
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
@@ -6436,6 +6437,10 @@
*/
@Override
public void onImeWindowSetOnDisplay(final int pid, final int displayId) {
+ // Update display configuration for IME process only when Single-client IME window
+ // moving to another display.
+ if (!InputMethodSystemProperty.MULTI_CLIENT_IME_ENABLED) return;
+
if (pid == MY_PID || pid < 0) {
if (DEBUG_CONFIGURATION) {
Slog.w(TAG,
diff --git a/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java b/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java
index 46d0761..231025c 100644
--- a/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java
+++ b/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java
@@ -484,9 +484,6 @@
private void waitForHandlerToComplete(Handler handler, long waitTimeMs)
throws InterruptedException {
- if (!handler.hasMessagesOrCallbacks()) { // if nothing queued, do not wait.
- return;
- }
final Object lock = new Object();
synchronized (lock) {
handler.post(() -> {