diff options
17 files changed, 251 insertions, 48 deletions
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java index 46d9aac24d4f..99175b8becfe 100644 --- a/core/java/com/android/internal/os/Zygote.java +++ b/core/java/com/android/internal/os/Zygote.java @@ -518,7 +518,7 @@ public final class Zygote { ZygoteArguments args = null; // Load resources - ZygoteInit.nativePreloadOpenGL(); + ZygoteInit.nativePreloadGraphicsDriver(); while (true) { try { diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java index e19eb998849b..f9e868fafe50 100644 --- a/core/java/com/android/internal/os/ZygoteInit.java +++ b/core/java/com/android/internal/os/ZygoteInit.java @@ -85,7 +85,8 @@ public class ZygoteInit { // TODO (chriswailes): Change this so it is set with Zygote or ZygoteSecondary as appropriate private static final String TAG = "Zygote"; - private static final String PROPERTY_DISABLE_OPENGL_PRELOADING = "ro.zygote.disable_gl_preload"; + private static final String PROPERTY_DISABLE_GRAPHICS_DRIVER_PRELOADING = + "ro.zygote.disable_gl_preload"; private static final String PROPERTY_GFX_DRIVER = "ro.gfx.driver.0"; private static final int LOG_BOOT_PROGRESS_PRELOAD_START = 3020; @@ -149,8 +150,8 @@ public class ZygoteInit { Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadAppProcessHALs"); nativePreloadAppProcessHALs(); Trace.traceEnd(Trace.TRACE_TAG_DALVIK); - Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadOpenGL"); - maybePreloadOpenGL(); + Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadGraphicsDriver"); + maybePreloadGraphicsDriver(); Trace.traceEnd(Trace.TRACE_TAG_DALVIK); preloadSharedLibraries(); preloadTextResources(); @@ -193,19 +194,19 @@ public class ZygoteInit { native private static void nativePreloadAppProcessHALs(); /** - * This call loads the graphics driver by attempting to make an OpenGL call. If the driver is + * This call loads the graphics driver by making an OpenGL or Vulkan call. If the driver is * not currently in memory it will load and initialize it. The OpenGL call itself is relatively * cheap and pure. This means that it is a low overhead on the initial call, and is safe and * cheap to call later. Calls after the initial invocation will effectively be no-ops for the * system. */ - static native void nativePreloadOpenGL(); + static native void nativePreloadGraphicsDriver(); - private static void maybePreloadOpenGL() { + private static void maybePreloadGraphicsDriver() { String driverPackageName = SystemProperties.get(PROPERTY_GFX_DRIVER); - if (!SystemProperties.getBoolean(PROPERTY_DISABLE_OPENGL_PRELOADING, false) && - (driverPackageName == null || driverPackageName.isEmpty())) { - nativePreloadOpenGL(); + if (!SystemProperties.getBoolean(PROPERTY_DISABLE_GRAPHICS_DRIVER_PRELOADING, false) + && (driverPackageName == null || driverPackageName.isEmpty())) { + nativePreloadGraphicsDriver(); } } diff --git a/core/java/com/android/internal/policy/DecorContext.java b/core/java/com/android/internal/policy/DecorContext.java index 67cdd5d8a479..56a40a3698cc 100644 --- a/core/java/com/android/internal/policy/DecorContext.java +++ b/core/java/com/android/internal/policy/DecorContext.java @@ -25,6 +25,8 @@ import android.view.WindowManager; import android.view.WindowManagerImpl; import android.view.contentcapture.ContentCaptureManager; +import com.android.internal.annotations.VisibleForTesting; + import java.lang.ref.WeakReference; /** @@ -34,7 +36,8 @@ import java.lang.ref.WeakReference; * * @hide */ -class DecorContext extends ContextThemeWrapper { +@VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) +public class DecorContext extends ContextThemeWrapper { private PhoneWindow mPhoneWindow; private WindowManager mWindowManager; private Resources mActivityResources; @@ -42,8 +45,9 @@ class DecorContext extends ContextThemeWrapper { private WeakReference<Context> mActivityContext; + @VisibleForTesting public DecorContext(Context context, Context activityContext) { - super(context, null); + super(context.createDisplayContext(activityContext.getDisplay()), null); mActivityContext = new WeakReference<>(activityContext); mActivityResources = activityContext.getResources(); } diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java index d945e139dd0f..d50a70ed62ef 100644 --- a/core/java/com/android/internal/policy/DecorView.java +++ b/core/java/com/android/internal/policy/DecorView.java @@ -1943,6 +1943,13 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind initializeElevation(); } + @Override + public void onMovedToDisplay(int displayId, Configuration config) { + super.onMovedToDisplay(displayId, config); + // Have to explicitly update displayId because it may use DecorContext + getContext().updateDisplay(displayId); + } + /** * Determines if the workspace is entirely covered by the window. * @return {@code true} when the window is filling the entire screen/workspace. diff --git a/core/jni/com_android_internal_os_ZygoteInit.cpp b/core/jni/com_android_internal_os_ZygoteInit.cpp index ac0e60030fc5..5cca0fdc735b 100644 --- a/core/jni/com_android_internal_os_ZygoteInit.cpp +++ b/core/jni/com_android_internal_os_ZygoteInit.cpp @@ -17,12 +17,17 @@ #define LOG_TAG "Zygote" #include <EGL/egl.h> +#include <Properties.h> #include <ui/GraphicBufferMapper.h> +#include <vulkan/vulkan.h> #include "core_jni_helpers.h" namespace { +using android::uirenderer::Properties; +using android::uirenderer::RenderPipelineType; + // Shadow call stack (SCS) is a security mitigation that uses a separate stack // (the SCS) for return addresses. In versions of Android newer than P, the // compiler cooperates with the system to ensure that the SCS address is always @@ -58,16 +63,21 @@ void android_internal_os_ZygoteInit_nativePreloadAppProcessHALs(JNIEnv* env, jcl // (b) loaded by most app processes. } -void android_internal_os_ZygoteInit_nativePreloadOpenGL(JNIEnv* env, jclass) { +void android_internal_os_ZygoteInit_nativePreloadGraphicsDriver(JNIEnv* env, jclass) { ScopedSCSExit x; - eglGetDisplay(EGL_DEFAULT_DISPLAY); + if (Properties::peekRenderPipelineType() == RenderPipelineType::SkiaGL) { + eglGetDisplay(EGL_DEFAULT_DISPLAY); + } else { + uint32_t count = 0; + vkEnumerateInstanceExtensionProperties(nullptr, &count, nullptr); + } } const JNINativeMethod gMethods[] = { { "nativePreloadAppProcessHALs", "()V", (void*)android_internal_os_ZygoteInit_nativePreloadAppProcessHALs }, - { "nativePreloadOpenGL", "()V", - (void*)android_internal_os_ZygoteInit_nativePreloadOpenGL }, + { "nativePreloadGraphicsDriver", "()V", + (void*)android_internal_os_ZygoteInit_nativePreloadGraphicsDriver }, }; } // anonymous namespace diff --git a/core/res/res/values/styles_device_defaults.xml b/core/res/res/values/styles_device_defaults.xml index d253f00c1d6c..b716ab985175 100644 --- a/core/res/res/values/styles_device_defaults.xml +++ b/core/res/res/values/styles_device_defaults.xml @@ -99,6 +99,7 @@ easier. <style name="Widget.DeviceDefault.ActionBar.TabText" parent="Widget.Material.ActionBar.TabText"/> <style name="Widget.DeviceDefault.ActionBar.TabBar" parent="Widget.Material.ActionBar.TabBar"/> <style name="Widget.DeviceDefault.ActionBar.Solid" parent="Widget.Material.ActionBar.Solid"> + <item name="titleTextStyle">@style/TextAppearance.DeviceDefault.Widget.ActionBar.Title</item> <item name="background">?attr/colorPrimaryDark</item> <item name="backgroundStacked">?attr/colorPrimaryDark</item> <item name="backgroundSplit">?attr/colorPrimaryDark</item> diff --git a/core/tests/coretests/src/com/android/internal/policy/DecorContextTest.java b/core/tests/coretests/src/com/android/internal/policy/DecorContextTest.java new file mode 100644 index 000000000000..cd706089929e --- /dev/null +++ b/core/tests/coretests/src/com/android/internal/policy/DecorContextTest.java @@ -0,0 +1,78 @@ +/* + * 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.internal.policy; + +import static android.view.Display.DEFAULT_DISPLAY; + +import static org.junit.Assert.assertEquals; + +import android.content.Context; +import android.hardware.display.DisplayManagerGlobal; +import android.platform.test.annotations.Presubmit; +import android.view.Display; +import android.view.DisplayAdjustments; +import android.view.DisplayInfo; +import android.view.WindowManager; + +import androidx.test.InstrumentationRegistry; +import androidx.test.filters.SmallTest; +import androidx.test.runner.AndroidJUnit4; + + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Tests {@link DecorContext}. + */ +@SmallTest +@Presubmit +@RunWith(AndroidJUnit4.class) +public final class DecorContextTest { + private Context mContext; + private static final int EXTERNAL_DISPLAY = DEFAULT_DISPLAY + 1; + + @Before + public void setUp() throws Exception { + mContext = InstrumentationRegistry.getContext(); + } + + @Test + public void testDecorContextWithDefaultDisplay() { + DecorContext context = new DecorContext(mContext.getApplicationContext(), mContext); + + assertDecorContextDisplay(DEFAULT_DISPLAY, context); + } + + @Test + public void testDecorContextWithExternalDisplay() { + Display display = new Display(DisplayManagerGlobal.getInstance(), EXTERNAL_DISPLAY, + new DisplayInfo(), DisplayAdjustments.DEFAULT_DISPLAY_ADJUSTMENTS); + DecorContext context = new DecorContext(mContext.getApplicationContext(), + mContext.createDisplayContext(display)); + + assertDecorContextDisplay(EXTERNAL_DISPLAY, context); + } + + private static void assertDecorContextDisplay(int expectedDisplayId, + DecorContext decorContext) { + WindowManager wm = (WindowManager) decorContext.getSystemService(Context.WINDOW_SERVICE); + Display associatedDisplay = wm.getDefaultDisplay(); + assertEquals(expectedDisplayId, associatedDisplay.getDisplayId()); + } +} diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp index 56d18217e2f1..af20c4f4f20e 100644 --- a/libs/hwui/Properties.cpp +++ b/libs/hwui/Properties.cpp @@ -169,24 +169,22 @@ ProfileType Properties::getProfileType() { return sProfileType; } -RenderPipelineType Properties::getRenderPipelineType() { +RenderPipelineType Properties::peekRenderPipelineType() { + // If sRenderPipelineType has been locked, just return the locked type immediately. if (sRenderPipelineType != RenderPipelineType::NotInitialized) { return sRenderPipelineType; } bool useVulkan = use_vulkan().value_or(false); char prop[PROPERTY_VALUE_MAX]; - if (useVulkan) { - property_get(PROPERTY_RENDERER, prop, "skiavk"); - } else { - property_get(PROPERTY_RENDERER, prop, "skiagl"); - } + property_get(PROPERTY_RENDERER, prop, useVulkan ? "skiavk" : "skiagl"); if (!strcmp(prop, "skiavk")) { - ALOGD("Skia Vulkan Pipeline"); - sRenderPipelineType = RenderPipelineType::SkiaVulkan; - } else { //"skiagl" - ALOGD("Skia GL Pipeline"); - sRenderPipelineType = RenderPipelineType::SkiaGL; + return RenderPipelineType::SkiaVulkan; } + return RenderPipelineType::SkiaGL; +} + +RenderPipelineType Properties::getRenderPipelineType() { + sRenderPipelineType = peekRenderPipelineType(); return sRenderPipelineType; } diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h index 22e15c7e6424..71b07c947716 100644 --- a/libs/hwui/Properties.h +++ b/libs/hwui/Properties.h @@ -214,6 +214,7 @@ public: static int overrideSpotShadowStrength; static ProfileType getProfileType(); + ANDROID_API static RenderPipelineType peekRenderPipelineType(); ANDROID_API static RenderPipelineType getRenderPipelineType(); ANDROID_API static bool enableHighContrastText; diff --git a/packages/PrintSpooler/res/values-sk/strings.xml b/packages/PrintSpooler/res/values-sk/strings.xml index 6fe9004d2e91..628ba53eb07e 100644 --- a/packages/PrintSpooler/res/values-sk/strings.xml +++ b/packages/PrintSpooler/res/values-sk/strings.xml @@ -67,7 +67,7 @@ <string name="notification_channel_failure" msgid="9042250774797916414">"Neúspešné tlačové úlohy"</string> <string name="could_not_create_file" msgid="3425025039427448443">"Súbor nie je možné vytvoriť"</string> <string name="print_services_disabled_toast" msgid="9089060734685174685">"Niektoré tlačové služby sú zakázané"</string> - <string name="print_searching_for_printers" msgid="6550424555079932867">"Vyhľadávanie tlačiarní"</string> + <string name="print_searching_for_printers" msgid="6550424555079932867">"Hľadajú sa tlačiarne"</string> <string name="print_no_print_services" msgid="8561247706423327966">"Žiadne tlačové služby nie sú aktivované"</string> <string name="print_no_printers" msgid="4869403323900054866">"Nenašli sa žiadne tlačiarne"</string> <string name="cannot_add_printer" msgid="7840348733668023106">"Nie je možné pridať tlačiarne"</string> diff --git a/packages/SettingsLib/res/values/strings.xml b/packages/SettingsLib/res/values/strings.xml index 8a39b82c0bd9..aad9e7968e0a 100644 --- a/packages/SettingsLib/res/values/strings.xml +++ b/packages/SettingsLib/res/values/strings.xml @@ -32,14 +32,18 @@ <string name="wifi_security_short_psk_generic" translatable="false">@string/wifi_security_short_wpa_wpa2</string> <!-- Do not translate. Concise terminology for wifi with 802.1x EAP security --> <string name="wifi_security_short_eap" translatable="false">802.1x</string> + <!-- Do not translate. Concise terminology for wifi with WPA 802.1x EAP security --> + <string name="wifi_security_short_eap_wpa" translatable="false">WPA-EAP</string> + <!-- Do not translate. Concise terminology for wifi with WPA2/WPA3 802.1x EAP security --> + <string name="wifi_security_short_eap_wpa2_wpa3" translatable="false">RSN-EAP</string> <!-- Do not translate. Concise terminology for wifi with WPA3 security --> <string name="wifi_security_short_sae" translatable="false">WPA3</string> <!-- Do not translate. Concise terminology for wifi with WPA2/WPA3 transition security --> <string name="wifi_security_short_psk_sae" translatable="false">WPA2/WPA3</string> <!-- Do not translate. Concise terminology for wifi with OWE security --> <string name="wifi_security_short_owe" translatable="false">OWE</string> - <!-- Do not translate. Concise terminology for wifi with 802.1x EAP Suite-B security --> - <string name="wifi_security_short_eap_suiteb" translatable="false">Suite-B</string> + <!-- Do not translate. Concise terminology for wifi with 802.1x EAP Suite-B-192 security --> + <string name="wifi_security_short_eap_suiteb" translatable="false">Suite-B-192</string> <!-- Used in Wi-Fi settings dialogs when Wi-Fi does not have any security. [CHAR LIMIT=40] --> <string name="wifi_security_none">None</string> @@ -55,7 +59,11 @@ <!-- Do not translate. Terminology for wifi with unknown PSK type --> <string name="wifi_security_psk_generic" translatable="false">@string/wifi_security_wpa_wpa2</string> <!-- Do not translate. Concise terminology for wifi with 802.1x EAP security --> - <string name="wifi_security_eap" translatable="false">WPA/WPA2-Enterprise</string> + <string name="wifi_security_eap" translatable="false">WPA/WPA2/WPA3-Enterprise</string> + <!-- Do not translate. Concise terminology for wifi with WPA 802.1x EAP security --> + <string name="wifi_security_eap_wpa" translatable="false">WPA-Enterprise</string> + <!-- Do not translate. Concise terminology for wifi with WPA2/WPA3 802.1x EAP security --> + <string name="wifi_security_eap_wpa2_wpa3" translatable="false">WPA2/WPA3-Enterprise</string> <!-- Do not translate. Concise terminology for Passpoint network --> <string name="wifi_security_passpoint" translatable="false">Passpoint</string> <!-- Do not translate. Terminology for wifi with WPA3 security --> @@ -64,8 +72,8 @@ <string name="wifi_security_psk_sae" translatable="false">WPA2/WPA3-Personal</string> <!-- Do not translate. Terminology for wifi with OWE security --> <string name="wifi_security_owe" translatable="false">Enhanced Open</string> - <!-- Do not translate. Concise terminology for wifi with 802.1x EAP Suite-B security --> - <string name="wifi_security_eap_suiteb" translatable="false">WPA3-Enterprise</string> + <!-- Do not translate. Concise terminology for wifi with 802.1x EAP Suite-B-192 security --> + <string name="wifi_security_eap_suiteb" translatable="false">WPA3-Enterprise 192-bit</string> <!-- Summary for the remembered network. --> <string name="wifi_remembered">Saved</string> diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java index d1e4fdf472c0..34d11b5ecbbc 100644 --- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java +++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java @@ -164,6 +164,7 @@ public class AccessPoint implements Comparable<AccessPoint> { static final String KEY_IS_CARRIER_AP = "key_is_carrier_ap"; static final String KEY_CARRIER_AP_EAP_TYPE = "key_carrier_ap_eap_type"; static final String KEY_CARRIER_NAME = "key_carrier_name"; + static final String KEY_EAPTYPE = "eap_psktype"; static final AtomicInteger sLastId = new AtomicInteger(0); /* @@ -186,6 +187,10 @@ public class AccessPoint implements Comparable<AccessPoint> { private static final int PSK_WPA_WPA2 = 3; private static final int PSK_SAE = 4; + private static final int EAP_UNKNOWN = 0; + private static final int EAP_WPA = 1; // WPA-EAP + private static final int EAP_WPA2_WPA3 = 2; // RSN-EAP + /** * The number of distinct wifi levels. * @@ -210,6 +215,7 @@ public class AccessPoint implements Comparable<AccessPoint> { private int networkId = WifiConfiguration.INVALID_NETWORK_ID; private int pskType = PSK_UNKNOWN; + private int mEapType = EAP_UNKNOWN; private WifiConfiguration mConfig; @@ -267,6 +273,9 @@ public class AccessPoint implements Comparable<AccessPoint> { if (savedState.containsKey(KEY_PSKTYPE)) { pskType = savedState.getInt(KEY_PSKTYPE); } + if (savedState.containsKey(KEY_EAPTYPE)) { + mEapType = savedState.getInt(KEY_EAPTYPE); + } mInfo = savedState.getParcelable(KEY_WIFIINFO); if (savedState.containsKey(KEY_NETWORKINFO)) { mNetworkInfo = savedState.getParcelable(KEY_NETWORKINFO); @@ -776,6 +785,9 @@ public class AccessPoint implements Comparable<AccessPoint> { if (security == SECURITY_PSK || security == SECURITY_SAE) { pskType = getPskType(bestResult); } + if (security == SECURITY_EAP) { + mEapType = getEapType(bestResult); + } mIsCarrierAp = bestResult.isCarrierAp; mCarrierApEapType = bestResult.carrierApEapType; mCarrierName = bestResult.carrierName; @@ -810,8 +822,20 @@ public class AccessPoint implements Comparable<AccessPoint> { } switch(security) { case SECURITY_EAP: - return concise ? context.getString(R.string.wifi_security_short_eap) : - context.getString(R.string.wifi_security_eap); + switch (mEapType) { + case EAP_WPA: + return concise ? context.getString(R.string.wifi_security_short_eap_wpa) : + context.getString(R.string.wifi_security_eap_wpa); + case EAP_WPA2_WPA3: + return concise + ? context.getString(R.string.wifi_security_short_eap_wpa2_wpa3) : + context.getString(R.string.wifi_security_eap_wpa2_wpa3); + case EAP_UNKNOWN: + default: + return concise + ? context.getString(R.string.wifi_security_short_eap) : + context.getString(R.string.wifi_security_eap); + } case SECURITY_EAP_SUITE_B: return concise ? context.getString(R.string.wifi_security_short_eap_suiteb) : context.getString(R.string.wifi_security_eap_suiteb); @@ -1161,6 +1185,7 @@ public class AccessPoint implements Comparable<AccessPoint> { savedState.putInt(KEY_SECURITY, security); savedState.putInt(KEY_SPEED, mSpeed); savedState.putInt(KEY_PSKTYPE, pskType); + savedState.putInt(KEY_EAPTYPE, mEapType); if (mConfig != null) savedState.putParcelable(KEY_CONFIG, mConfig); savedState.putParcelable(KEY_WIFIINFO, mInfo); savedState.putParcelableArray(KEY_SCANRESULTS, @@ -1494,6 +1519,18 @@ public class AccessPoint implements Comparable<AccessPoint> { } } + private static int getEapType(ScanResult result) { + // WPA2-Enterprise and WPA3-Enterprise (non 192-bit) advertise RSN-EAP-CCMP + if (result.capabilities.contains("RSN-EAP")) { + return EAP_WPA2_WPA3; + } + // WPA-Enterprise advertises WPA-EAP-TKIP + if (result.capabilities.contains("WPA-EAP")) { + return EAP_WPA; + } + return EAP_UNKNOWN; + } + private static int getSecurity(ScanResult result) { if (result.capabilities.contains("WEP")) { return SECURITY_WEP; diff --git a/services/core/java/com/android/server/audio/BtHelper.java b/services/core/java/com/android/server/audio/BtHelper.java index 068c3d8a1264..934c7bfe3392 100644 --- a/services/core/java/com/android/server/audio/BtHelper.java +++ b/services/core/java/com/android/server/audio/BtHelper.java @@ -678,7 +678,11 @@ public class BtHelper { // @GuardedBy("AudioDeviceBroker.mDeviceStateLock") @GuardedBy("BtHelper.this") void incCount(int scoAudioMode) { - requestScoState(BluetoothHeadset.STATE_AUDIO_CONNECTED, scoAudioMode); + if (!requestScoState(BluetoothHeadset.STATE_AUDIO_CONNECTED, scoAudioMode)) { + Log.e(TAG, "Request sco connected with scoAudioMode(" + + scoAudioMode + ") failed"); + return; + } if (mStartcount == 0) { try { mCb.linkToDeath(this, 0); @@ -706,7 +710,9 @@ public class BtHelper { Log.w(TAG, "decCount() going to 0 but not registered to binder"); } } - requestScoState(BluetoothHeadset.STATE_AUDIO_DISCONNECTED, 0); + if (!requestScoState(BluetoothHeadset.STATE_AUDIO_DISCONNECTED, 0)) { + Log.w(TAG, "Request sco disconnected with scoAudioMode(0) failed"); + } } } @@ -751,13 +757,13 @@ public class BtHelper { // @GuardedBy("AudioDeviceBroker.mSetModeLock") //@GuardedBy("AudioDeviceBroker.mDeviceStateLock") @GuardedBy("BtHelper.this") - private void requestScoState(int state, int scoAudioMode) { + private boolean requestScoState(int state, int scoAudioMode) { checkScoAudioState(); int clientCount = totalCount(); if (clientCount != 0) { Log.i(TAG, "requestScoState: state=" + state + ", scoAudioMode=" + scoAudioMode + ", clientCount=" + clientCount); - return; + return true; } if (state == BluetoothHeadset.STATE_AUDIO_CONNECTED) { // Make sure that the state transitions to CONNECTING even if we cannot initiate @@ -770,7 +776,7 @@ public class BtHelper { Log.w(TAG, "requestScoState: audio mode is not NORMAL and modeOwnerPid " + modeOwnerPid + " != creatorPid " + mCreatorPid); broadcastScoConnectionState(AudioManager.SCO_AUDIO_STATE_DISCONNECTED); - return; + return false; } switch (mScoAudioState) { case SCO_STATE_INACTIVE: @@ -796,6 +802,7 @@ public class BtHelper { + " connection, mScoAudioMode=" + mScoAudioMode); broadcastScoConnectionState( AudioManager.SCO_AUDIO_STATE_DISCONNECTED); + return false; } break; } @@ -804,7 +811,7 @@ public class BtHelper { + " mScoAudioMode=" + mScoAudioMode); broadcastScoConnectionState( AudioManager.SCO_AUDIO_STATE_DISCONNECTED); - break; + return false; } if (connectBluetoothScoAudioHelper(mBluetoothHeadset, mBluetoothHeadsetDevice, mScoAudioMode)) { @@ -814,6 +821,7 @@ public class BtHelper { + " failed, mScoAudioMode=" + mScoAudioMode); broadcastScoConnectionState( AudioManager.SCO_AUDIO_STATE_DISCONNECTED); + return false; } break; case SCO_STATE_DEACTIVATING: @@ -827,7 +835,7 @@ public class BtHelper { Log.w(TAG, "requestScoState: failed to connect in state " + mScoAudioState + ", scoAudioMode=" + scoAudioMode); broadcastScoConnectionState(AudioManager.SCO_AUDIO_STATE_DISCONNECTED); - break; + return false; } } else if (state == BluetoothHeadset.STATE_AUDIO_DISCONNECTED) { @@ -842,6 +850,7 @@ public class BtHelper { mScoAudioState = SCO_STATE_INACTIVE; broadcastScoConnectionState( AudioManager.SCO_AUDIO_STATE_DISCONNECTED); + return false; } break; } @@ -868,9 +877,10 @@ public class BtHelper { Log.w(TAG, "requestScoState: failed to disconnect in state " + mScoAudioState + ", scoAudioMode=" + scoAudioMode); broadcastScoConnectionState(AudioManager.SCO_AUDIO_STATE_DISCONNECTED); - break; + return false; } } + return true; } } 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 a7d0a5c706b6..f599adb5118a 100644 --- a/services/core/java/com/android/server/display/color/ColorDisplayService.java +++ b/services/core/java/com/android/server/display/color/ColorDisplayService.java @@ -1241,6 +1241,14 @@ public final class ColorDisplayService extends SystemService { } /** + * Reset the CCT value for the display white balance transform to its default value. + */ + public boolean resetDisplayWhiteBalanceColorTemperature() { + return setDisplayWhiteBalanceColorTemperature(getContext().getResources() + .getInteger(R.integer.config_displayWhiteBalanceColorTemperatureDefault)); + } + + /** * Sets the listener and returns whether display white balance is currently enabled. */ public boolean setDisplayWhiteBalanceListener(DisplayWhiteBalanceListener listener) { diff --git a/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceController.java b/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceController.java index c32ae97da14f..0f86b478468f 100644 --- a/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceController.java +++ b/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceController.java @@ -405,6 +405,7 @@ public class DisplayWhiteBalanceController implements mThrottler.clear(); mAmbientColorTemperature = -1.0f; mPendingAmbientColorTemperature = -1.0f; + mColorDisplayServiceInternal.resetDisplayWhiteBalanceColorTemperature(); return true; } diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java index a612799549a2..2321898b91cc 100644 --- a/services/core/java/com/android/server/wm/AppWindowToken.java +++ b/services/core/java/com/android/server/wm/AppWindowToken.java @@ -79,6 +79,7 @@ import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL; import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES; import static com.android.server.wm.WindowManagerService.logWithStack; import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM; +import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_BEFORE_ANIM; import android.annotation.CallSuper; import android.annotation.Size; @@ -2473,6 +2474,17 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree return getBounds(); } + @VisibleForTesting + Rect getAnimationBounds(int appStackClipMode) { + if (appStackClipMode == STACK_CLIP_BEFORE_ANIM && getStack() != null) { + // Using the stack bounds here effectively applies the clipping before animation. + return getStack().getBounds(); + } + // Use task-bounds if available so that activity-level letterbox (maxAspectRatio) is + // included in the animation. + return getTask() != null ? getTask().getBounds() : getBounds(); + } + boolean applyAnimationLocked(WindowManager.LayoutParams lp, int transit, boolean enter, boolean isVoiceInteraction) { @@ -2493,9 +2505,11 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree final AnimationAdapter adapter; AnimationAdapter thumbnailAdapter = null; - // Separate position and size for use in animators. Use task-bounds for now so - // that activity-level letterbox (maxAspectRatio) is included in the animation. - mTmpRect.set(getTask() != null ? getTask().getBounds() : getBounds()); + final int appStackClipMode = + getDisplayContent().mAppTransition.getAppStackClipMode(); + + // Separate position and size for use in animators. + mTmpRect.set(getAnimationBounds(appStackClipMode)); mTmpPoint.set(mTmpRect.left, mTmpRect.top); mTmpRect.offsetTo(0, 0); @@ -2529,8 +2543,6 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree mTransit = transit; mTransitFlags = getDisplayContent().mAppTransition.getTransitFlags(); } else { - final int appStackClipMode = - getDisplayContent().mAppTransition.getAppStackClipMode(); mNeedsAnimationBoundsLayer = (appStackClipMode == STACK_CLIP_AFTER_ANIM); final Animation a = loadAnimation(lp, transit, enter, isVoiceInteraction); diff --git a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java index ca3f6846f74d..064b553bb314 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java @@ -16,6 +16,9 @@ package com.android.server.wm; +import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; +import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; +import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; @@ -34,6 +37,9 @@ import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentat import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spy; +import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM; +import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_BEFORE_ANIM; +import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_NONE; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -475,6 +481,27 @@ public class AppWindowTokenTests extends WindowTestsBase { assertHasStartingWindow(tokenBottom); } + @Test + public void testTransitionAnimationBounds() { + final Rect stackBounds = new Rect(0, 0, 1000, 600); + final Rect taskBounds = new Rect(100, 400, 600, 800); + mStack.setBounds(stackBounds); + mTask.setBounds(taskBounds); + + // Check that anim bounds for freeform window match task bounds + mTask.setWindowingMode(WINDOWING_MODE_FREEFORM); + assertEquals(taskBounds, mToken.getAnimationBounds(STACK_CLIP_NONE)); + + // STACK_CLIP_AFTER_ANIM should use task bounds since they will be clipped by + // bounds animation layer. + mTask.setWindowingMode(WINDOWING_MODE_FULLSCREEN); + assertEquals(taskBounds, mToken.getAnimationBounds(STACK_CLIP_AFTER_ANIM)); + + // STACK_CLIP_BEFORE_ANIM should use stack bounds since it won't be clipped later. + mTask.setWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY); + assertEquals(stackBounds, mToken.getAnimationBounds(STACK_CLIP_BEFORE_ANIM)); + } + private void assertHasStartingWindow(AppWindowToken atoken) { assertNotNull(atoken.startingSurface); assertNotNull(atoken.startingData); |