diff options
60 files changed, 495 insertions, 183 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index abf48a85c45e..35cb2f15a0a3 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -5413,8 +5413,8 @@ public final class ActivityThread { int uid = Process.myUid(); String[] packages = getPackageManager().getPackagesForUid(uid); if (packages != null) { - ThreadedRenderer.setupDiskCache(cacheDir); - RenderScriptCacheDir.setupDiskCache(cacheDir); + ThreadedRenderer.setupDiskCache(codeCacheDir); + RenderScriptCacheDir.setupDiskCache(codeCacheDir); } } catch (RemoteException e) { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); diff --git a/core/java/android/app/WallpaperColors.java b/core/java/android/app/WallpaperColors.java index b9d3e75b9943..d0791cf93469 100644 --- a/core/java/android/app/WallpaperColors.java +++ b/core/java/android/app/WallpaperColors.java @@ -136,12 +136,12 @@ public final class WallpaperColors implements Parcelable { } final int bitmapArea = bitmap.getWidth() * bitmap.getHeight(); + boolean shouldRecycle = false; if (bitmapArea > MAX_WALLPAPER_EXTRACTION_AREA) { + shouldRecycle = true; Size optimalSize = calculateOptimalSize(bitmap.getWidth(), bitmap.getHeight()); - Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, optimalSize.getWidth(), + bitmap = Bitmap.createScaledBitmap(bitmap, optimalSize.getWidth(), optimalSize.getHeight(), true /* filter */); - bitmap.recycle(); - bitmap = scaledBitmap; } final Palette palette = Palette @@ -181,6 +181,11 @@ public final class WallpaperColors implements Parcelable { } int hints = calculateHints(bitmap); + + if (shouldRecycle) { + bitmap.recycle(); + } + return new WallpaperColors(primary, secondary, tertiary, hints); } diff --git a/core/java/android/content/pm/LauncherApps.java b/core/java/android/content/pm/LauncherApps.java index ed41e79e2c6c..aa9562ff040f 100644 --- a/core/java/android/content/pm/LauncherApps.java +++ b/core/java/android/content/pm/LauncherApps.java @@ -608,15 +608,15 @@ public class LauncherApps { } /** - * Get {@link ApplicationInfo} for a profile + * Returns {@link ApplicationInfo} about an application installed for a specific user profile. * * @param packageName The package name of the application * @param flags Additional option flags {@link PackageManager#getApplicationInfo} * @param user The UserHandle of the profile. * - * @return An {@link ApplicationInfo} containing information about the package or - * null if the package isn't installed for the given user, or the target user - * is not enabled. + * @return {@link ApplicationInfo} containing information about the package. Returns + * {@code null} if the package isn't installed for the given profile, or the profile + * isn't enabled. */ public ApplicationInfo getApplicationInfo(@NonNull String packageName, @ApplicationInfoFlags int flags, @NonNull UserHandle user) diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index b39f9a5816fe..bcba938e4ed8 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -40,7 +40,7 @@ import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_NO_CERTIFIC import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION; import static android.os.Build.VERSION_CODES.O; import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER; -import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_ROTATE; +import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED; import android.annotation.IntRange; import android.annotation.NonNull; @@ -4283,7 +4283,7 @@ public class PackageParser { sa.getString(R.styleable.AndroidManifestActivity_enableVrMode); a.info.rotationAnimation = - sa.getInt(R.styleable.AndroidManifestActivity_rotationAnimation, ROTATION_ANIMATION_ROTATE); + sa.getInt(R.styleable.AndroidManifestActivity_rotationAnimation, ROTATION_ANIMATION_UNSPECIFIED); a.info.colorMode = sa.getInt(R.styleable.AndroidManifestActivity_colorMode, ActivityInfo.COLOR_MODE_DEFAULT); diff --git a/core/java/android/net/VpnService.java b/core/java/android/net/VpnService.java index 2d9860cf0e40..4b79cbb98d8c 100644 --- a/core/java/android/net/VpnService.java +++ b/core/java/android/net/VpnService.java @@ -99,7 +99,7 @@ import java.util.List; * shut down the tunnel gracefully.</li> * </ol> * - * <p>Services extended this class need to be declared with appropriate + * <p>Services extending this class need to be declared with an appropriate * permission and intent filter. Their access must be secured by * {@link android.Manifest.permission#BIND_VPN_SERVICE} permission, and * their intent filter must match {@link #SERVICE_INTERFACE} action. Here @@ -112,6 +112,13 @@ import java.util.List; * </intent-filter> * </service></pre> * + * <p> The Android system starts a VPN in the background by calling + * {@link android.content.Context#startService startService()}. In Android 8.0 + * (API level 26) and higher, the system places VPN apps on the temporary + * whitelist for a short period so the app can start in the background. The VPN + * app must promote itself to the foreground after it's launched or the system + * will shut down the app. + * * @see Builder */ public class VpnService extends Service { diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index e84a041dae08..d822f961ce66 100755 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -1437,10 +1437,10 @@ public final class Settings { * to the caller package. * * <p> - * <b>NOTE: </b> applications should call + * <b>NOTE: </b> Applications should call * {@link android.view.autofill.AutofillManager#hasEnabledAutofillServices()} and - * {@link android.view.autofill.AutofillManager#isAutofillSupported()} first, and only - * broadcast this intent if they return {@code false} and {@code true} respectively. + * {@link android.view.autofill.AutofillManager#isAutofillSupported()}, and only use this action + * to start an activity if they return {@code false} and {@code true} respectively. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_REQUEST_SET_AUTOFILL_SERVICE = diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 48f3973e87fe..9b881fd3d1c8 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -1743,6 +1743,13 @@ public interface WindowManager extends ViewManager { public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE; /** + * Unspecified value for {@link #rotationAnimation} indicating + * a lack of preference. + * @hide + */ + public static final int ROTATION_ANIMATION_UNSPECIFIED = -1; + + /** * Value for {@link #rotationAnimation} which specifies that this * window will visually rotate in or out following a rotation. */ diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index e3b917828834..53a965452df3 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -648,8 +648,12 @@ public class LockPatternUtils { boolean disabledByDefault = mContext.getResources().getBoolean( com.android.internal.R.bool.config_disableLockscreenByDefault); boolean isSystemUser = UserManager.isSplitSystemUser() && userId == UserHandle.USER_SYSTEM; + UserInfo userInfo = getUserManager().getUserInfo(userId); + boolean isDemoUser = UserManager.isDeviceInDemoMode(mContext) && userInfo != null + && userInfo.isDemo(); return getBoolean(DISABLE_LOCKSCREEN_KEY, false, userId) - || (disabledByDefault && !isSystemUser); + || (disabledByDefault && !isSystemUser) + || isDemoUser; } /** diff --git a/core/res/res/layout/notification_template_material_big_text.xml b/core/res/res/layout/notification_template_material_big_text.xml index 1aca99feb872..0cfe6898f111 100644 --- a/core/res/res/layout/notification_template_material_big_text.xml +++ b/core/res/res/layout/notification_template_material_big_text.xml @@ -55,6 +55,7 @@ android:singleLine="false" android:gravity="top" android:visibility="gone" + android:textAlignment="viewStart" /> </LinearLayout> diff --git a/core/res/res/layout/notification_template_part_line1.xml b/core/res/res/layout/notification_template_part_line1.xml index 308b30ff36a9..ca35de3922ed 100644 --- a/core/res/res/layout/notification_template_part_line1.xml +++ b/core/res/res/layout/notification_template_part_line1.xml @@ -28,6 +28,7 @@ android:singleLine="true" android:ellipsize="marquee" android:fadingEdge="horizontal" + android:textAlignment="viewStart" /> <TextView android:id="@+id/text_line_1" android:textAppearance="@style/TextAppearance.Material.Notification" diff --git a/core/res/res/layout/notification_template_text.xml b/core/res/res/layout/notification_template_text.xml index 20c2896cd545..68f34c8e5b52 100644 --- a/core/res/res/layout/notification_template_text.xml +++ b/core/res/res/layout/notification_template_text.xml @@ -24,5 +24,6 @@ android:fadingEdge="horizontal" android:gravity="top" android:singleLine="true" + android:textAlignment="viewStart" android:textAppearance="@style/TextAppearance.Material.Notification" /> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 7b437fa2d355..a98738767aac 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -2775,6 +2775,9 @@ <!-- True if camera app should be pinned via Pinner Service --> <bool name="config_pinnerCameraApp">false</bool> + <!-- Component that runs demo mode when it is enabled. --> + <string name="config_demoModePackage" translatable="false"></string> + <!-- Component that is the default launcher when demo mode is enabled. --> <string name="config_demoModeLauncherComponent">com.android.retaildemo/.DemoPlayer</string> diff --git a/core/res/res/values/locale_config.xml b/core/res/res/values/locale_config.xml index ba148431cd19..0ba8b578a1c1 100644 --- a/core/res/res/values/locale_config.xml +++ b/core/res/res/values/locale_config.xml @@ -463,8 +463,6 @@ <item>teo-KE</item> <!-- Teso (Kenya) --> <item>teo-UG</item> <!-- Teso (Uganda) --> <item>th-TH</item> <!-- Thai (Thailand) --> - <item>ti-ER</item> <!-- Tigrinya (Eritrea) --> - <item>ti-ET</item> <!-- Tigrinya (Ethiopia) --> <item>to-TO</item> <!-- Tongan (Tonga) --> <item>tr-CY</item> <!-- Turkish (Cyprus) --> <item>tr-TR</item> <!-- Turkish (Turkey) --> diff --git a/core/tests/utiltests/AndroidManifest.xml b/core/tests/utiltests/AndroidManifest.xml index da09894255c3..d6384e7b139e 100644 --- a/core/tests/utiltests/AndroidManifest.xml +++ b/core/tests/utiltests/AndroidManifest.xml @@ -40,6 +40,7 @@ <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <uses-permission android:name="android.permission.PACKET_KEEPALIVE_OFFLOAD" /> + <uses-permission android:name="android.permission.ACCESS_KEYGUARD_SECURE_STORAGE" /> <application> <uses-library android:name="android.test.runner" /> diff --git a/core/tests/utiltests/src/com/android/internal/util/LockPatternUtilsTest.java b/core/tests/utiltests/src/com/android/internal/util/LockPatternUtilsTest.java new file mode 100644 index 000000000000..b18ee171eb0c --- /dev/null +++ b/core/tests/utiltests/src/com/android/internal/util/LockPatternUtilsTest.java @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2017 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.util; + +import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_MANAGED; +import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import android.content.Context; +import android.content.ContextWrapper; +import android.content.pm.UserInfo; +import android.os.UserManager; +import android.provider.Settings; +import android.support.test.InstrumentationRegistry; +import android.support.test.filters.SmallTest; +import android.support.test.runner.AndroidJUnit4; + +import android.test.mock.MockContentResolver; +import com.android.internal.util.test.FakeSettingsProvider; +import com.android.internal.widget.ILockSettings; +import com.android.internal.widget.LockPatternUtils; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; + +@RunWith(AndroidJUnit4.class) +@SmallTest +public class LockPatternUtilsTest { + + private static final int DEMO_USER_ID = 5; + + private LockPatternUtils mLockPatternUtils; + + private void configureTest(boolean isSecure, boolean isDemoUser, int deviceDemoMode) + throws Exception { + final Context context = spy(new ContextWrapper(InstrumentationRegistry.getTargetContext())); + + final MockContentResolver cr = new MockContentResolver(context); + cr.addProvider(Settings.AUTHORITY, new FakeSettingsProvider()); + when(context.getContentResolver()).thenReturn(cr); + Settings.Global.putInt(cr, Settings.Global.DEVICE_DEMO_MODE, deviceDemoMode); + + final ILockSettings ils = Mockito.mock(ILockSettings.class); + when(ils.havePassword(DEMO_USER_ID)).thenReturn(isSecure); + when(ils.getLong("lockscreen.password_type", PASSWORD_QUALITY_UNSPECIFIED, DEMO_USER_ID)) + .thenReturn((long) PASSWORD_QUALITY_MANAGED); + // TODO(b/63758238): stop spying the class under test + mLockPatternUtils = spy(new LockPatternUtils(context)); + when(mLockPatternUtils.getLockSettings()).thenReturn(ils); + + final UserInfo userInfo = Mockito.mock(UserInfo.class); + when(userInfo.isDemo()).thenReturn(isDemoUser); + final UserManager um = Mockito.mock(UserManager.class); + when(um.getUserInfo(DEMO_USER_ID)).thenReturn(userInfo); + when(context.getSystemService(Context.USER_SERVICE)).thenReturn(um); + } + + @Test + public void isLockScreenDisabled_isDemoUser_true() throws Exception { + configureTest(false, true, 2); + assertTrue(mLockPatternUtils.isLockScreenDisabled(DEMO_USER_ID)); + } + + @Test + public void isLockScreenDisabled_isSecureAndDemoUser_false() throws Exception { + configureTest(true, true, 2); + assertFalse(mLockPatternUtils.isLockScreenDisabled(DEMO_USER_ID)); + } + + @Test + public void isLockScreenDisabled_isNotDemoUser_false() throws Exception { + configureTest(false, false, 2); + assertFalse(mLockPatternUtils.isLockScreenDisabled(DEMO_USER_ID)); + } + + @Test + public void isLockScreenDisabled_isNotInDemoMode_false() throws Exception { + configureTest(false, true, 0); + assertFalse(mLockPatternUtils.isLockScreenDisabled(DEMO_USER_ID)); + } +} diff --git a/packages/SettingsLib/src/com/android/settingslib/applications/PackageManagerWrapper.java b/packages/SettingsLib/src/com/android/settingslib/applications/PackageManagerWrapper.java index caa79297539d..6c79a6124ca2 100644 --- a/packages/SettingsLib/src/com/android/settingslib/applications/PackageManagerWrapper.java +++ b/packages/SettingsLib/src/com/android/settingslib/applications/PackageManagerWrapper.java @@ -123,4 +123,9 @@ public interface PackageManagerWrapper { * @return the label as a CharSequence */ CharSequence loadLabel(ApplicationInfo app); + + /** + * Retrieve all activities that can be performed for the given intent. + */ + List<ResolveInfo> queryIntentActivities(Intent intent, int flags); } diff --git a/packages/SettingsLib/src/com/android/settingslib/applications/PackageManagerWrapperImpl.java b/packages/SettingsLib/src/com/android/settingslib/applications/PackageManagerWrapperImpl.java index 9b2cd7cb6b28..dcb40b20365e 100644 --- a/packages/SettingsLib/src/com/android/settingslib/applications/PackageManagerWrapperImpl.java +++ b/packages/SettingsLib/src/com/android/settingslib/applications/PackageManagerWrapperImpl.java @@ -113,4 +113,9 @@ public class PackageManagerWrapperImpl implements PackageManagerWrapper { public CharSequence loadLabel(ApplicationInfo app) { return app.loadLabel(mPm); } + + @Override + public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) { + return mPm.queryIntentActivities(intent, flags); + } } diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml index 26a179a43531..b821e7e76c60 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml @@ -54,7 +54,7 @@ android:textStyle="normal" android:inputType="textPassword" android:textSize="16sp" - android:textColor="?attr/bgProtectTextColor" + android:textColor="?attr/wallpaperTextColor" android:textAppearance="?android:attr/textAppearanceMedium" android:imeOptions="flagForceAscii|actionDone" android:maxLength="500" diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml index 501d0a57148a..3283e0411ec4 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml @@ -54,7 +54,7 @@ android:layout_centerHorizontal="true" android:layout_marginRight="72dp" androidprv:scaledTextSize="@integer/scaled_password_text_size" - android:textColor="?attr/bgProtectTextColor" + android:textColor="?attr/wallpaperTextColor" android:contentDescription="@string/keyguard_accessibility_pin_area" /> <ImageButton diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_presentation.xml b/packages/SystemUI/res-keyguard/layout/keyguard_presentation.xml index 87b1ee791ba6..6dea4934dcb3 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_presentation.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_presentation.xml @@ -41,7 +41,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|top" - android:textColor="?attr/bgProtectTextColor" + android:textColor="?attr/wallpaperTextColor" android:singleLine="true" style="@style/widget_big_thin" android:format12Hour="@string/keyguard_widget_12_hours_format" diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml index c4732e42b5ad..cf87f9026e22 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml @@ -67,7 +67,7 @@ android:layout_centerHorizontal="true" android:layout_marginRight="72dp" androidprv:scaledTextSize="@integer/scaled_password_text_size" - android:textColor="?attr/bgProtectTextColor" + android:textColor="?attr/wallpaperTextColor" android:contentDescription="@string/keyguard_accessibility_sim_pin_area" /> <ImageButton diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml index 1c7defd6399a..3cae493c5722 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml @@ -68,7 +68,7 @@ android:layout_centerHorizontal="true" android:layout_marginRight="72dp" androidprv:scaledTextSize="@integer/scaled_password_text_size" - android:textColor="?attr/bgProtectTextColor" + android:textColor="?attr/wallpaperTextColor" android:contentDescription="@string/keyguard_accessibility_sim_puk_area" /> <ImageButton diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_status_area.xml b/packages/SystemUI/res-keyguard/layout/keyguard_status_area.xml index 7d12504604c8..f5efcaa42cbd 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_status_area.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_status_area.xml @@ -29,7 +29,7 @@ android:id="@+id/date_view" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="?attr/bgProtectTextColor" + android:textColor="?attr/wallpaperTextColor" style="@style/widget_label" android:letterSpacing="0.15" android:gravity="center" @@ -39,9 +39,9 @@ android:layout_height="wrap_content" android:drawablePadding="6dp" android:drawableStart="@drawable/ic_access_alarms_big" - android:drawableTint="?attr/bgProtectSecondaryTextColor" + android:drawableTint="?attr/wallpaperTextColorSecondary" android:drawableTintMode="src_in" - android:textColor="?attr/bgProtectSecondaryTextColor" + android:textColor="?attr/wallpaperTextColorSecondary" android:letterSpacing="0.15" style="@style/widget_label" android:layout_marginStart="6dp" diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml index 44fae86531b3..ef16ebaf9cf5 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml @@ -28,41 +28,46 @@ androidprv:layout_maxWidth="@dimen/keyguard_security_width" androidprv:layout_maxHeight="@dimen/keyguard_security_height" android:gravity="center_horizontal|top"> - <RelativeLayout - android:id="@+id/keyguard_clock_container" + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="center_horizontal|top"> - <TextClock - android:id="@+id/clock_view" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_centerHorizontal="true" - android:layout_alignParentTop="true" - android:textColor="?attr/bgProtectTextColor" - android:singleLine="true" - style="@style/widget_big_thin" - android:format12Hour="@string/keyguard_widget_12_hours_format" - android:format24Hour="@string/keyguard_widget_24_hours_format" - android:layout_marginBottom="@dimen/bottom_text_spacing_digital" /> - <com.android.systemui.ChargingView - android:id="@+id/battery_doze" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignTop="@id/clock_view" - android:layout_alignBottom="@id/clock_view" - android:layout_toEndOf="@id/clock_view" - android:visibility="invisible" - android:src="@drawable/ic_aod_charging_24dp" - android:contentDescription="@string/accessibility_ambient_display_charging" - /> - - <include layout="@layout/keyguard_status_area" - android:id="@+id/keyguard_status_area" + android:orientation="vertical"> + <RelativeLayout + android:id="@+id/keyguard_clock_container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_below="@id/clock_view" /> + android:layout_gravity="center_horizontal|top"> + <TextClock + android:id="@+id/clock_view" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_centerHorizontal="true" + android:layout_alignParentTop="true" + android:textColor="?attr/wallpaperTextColor" + android:singleLine="true" + style="@style/widget_big_thin" + android:format12Hour="@string/keyguard_widget_12_hours_format" + android:format24Hour="@string/keyguard_widget_24_hours_format" + android:layout_marginBottom="@dimen/bottom_text_spacing_digital" /> + <com.android.systemui.ChargingView + android:id="@+id/battery_doze" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignTop="@id/clock_view" + android:layout_alignBottom="@id/clock_view" + android:layout_toEndOf="@id/clock_view" + android:visibility="invisible" + android:src="@drawable/ic_aod_charging_24dp" + android:contentDescription="@string/accessibility_ambient_display_charging" + /> + + <include layout="@layout/keyguard_status_area" + android:id="@+id/keyguard_status_area" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/clock_view" /> + </RelativeLayout> <TextView android:id="@+id/owner_info" @@ -72,12 +77,11 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/date_owner_info_margin" android:layout_centerHorizontal="true" - android:layout_below="@id/keyguard_status_area" - android:textColor="?attr/bgProtectSecondaryTextColor" + android:textColor="?attr/wallpaperTextColorSecondary" android:textSize="@dimen/widget_label_font_size" android:letterSpacing="0.05" android:ellipsize="marquee" android:singleLine="true" /> - </RelativeLayout> + </LinearLayout> </com.android.keyguard.KeyguardStatusView> diff --git a/packages/SystemUI/res-keyguard/values/styles.xml b/packages/SystemUI/res-keyguard/values/styles.xml index 9eceeb40d6d5..ea867eed08b4 100644 --- a/packages/SystemUI/res-keyguard/values/styles.xml +++ b/packages/SystemUI/res-keyguard/values/styles.xml @@ -20,11 +20,11 @@ <resources> <!-- Keyguard PIN pad styles --> <style name="Keyguard.TextView" parent="@android:style/Widget.DeviceDefault.TextView"> - <item name="android:textColor">?attr/bgProtectSecondaryTextColor</item> + <item name="android:textColor">?attr/wallpaperTextColorSecondary</item> <item name="android:textSize">@dimen/kg_status_line_font_size</item> </style> <style name="Keyguard.TextView.EmergencyButton" parent="@android:style/DeviceDefault.ButtonBar"> - <item name="android:textColor">?attr/bgProtectSecondaryTextColor</item> + <item name="android:textColor">?attr/wallpaperTextColorSecondary</item> <item name="android:textSize">@dimen/kg_status_line_font_size</item> <item name="android:background">@null</item> </style> @@ -34,7 +34,7 @@ <item name="android:background">@null</item> <item name="android:textSize">32sp</item> <item name="android:fontFamily">@*android:string/config_headlineFontFamilyLight</item> - <item name="android:textColor">?attr/bgProtectTextColor</item> + <item name="android:textColor">?attr/wallpaperTextColor</item> <item name="android:paddingBottom">-16dp</item> </style> <style name="Keyguard.ImageButton.NumPadEnter" parent="@android:style/Widget.ImageButton"> @@ -43,7 +43,7 @@ <style name="Widget.TextView.NumPadKey.Klondike" parent="Widget.TextView.NumPadKey"> <item name="android:textSize">12sp</item> <item name="android:fontFamily">sans-serif</item> - <item name="android:textColor">?attr/bgProtectSecondaryTextColor</item> + <item name="android:textColor">?attr/wallpaperTextColorSecondary</item> <item name="android:paddingBottom">0dp</item> </style> @@ -61,9 +61,9 @@ </style> <style name="PasswordTheme" parent="systemui_theme"> - <item name="android:textColor">?attr/bgProtectTextColor</item> - <item name="android:colorControlNormal">?attr/bgProtectTextColor</item> - <item name="android:colorControlActivated">?attr/bgProtectTextColor</item> + <item name="android:textColor">?attr/wallpaperTextColor</item> + <item name="android:colorControlNormal">?attr/wallpaperTextColor</item> + <item name="android:colorControlActivated">?attr/wallpaperTextColor</item> </style> <style name="keyguard_presentation_theme" parent="@android:style/Theme.Material.NoActionBar.Fullscreen"> diff --git a/packages/SystemUI/res/color/background_protect_secondary.xml b/packages/SystemUI/res/color/background_protect_secondary.xml index 26dc1515d2a5..97744dbe9190 100644 --- a/packages/SystemUI/res/color/background_protect_secondary.xml +++ b/packages/SystemUI/res/color/background_protect_secondary.xml @@ -16,5 +16,5 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="?attr/bgProtectSecondaryTextColor" /> + <item android:color="?attr/wallpaperTextColorSecondary" /> </selector>
\ No newline at end of file diff --git a/packages/SystemUI/res/color/background_protected.xml b/packages/SystemUI/res/color/background_protected.xml index ab8ed8713145..ff2009d02d7e 100644 --- a/packages/SystemUI/res/color/background_protected.xml +++ b/packages/SystemUI/res/color/background_protected.xml @@ -16,5 +16,5 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="?attr/bgProtectTextColor" /> + <item android:color="?attr/wallpaperTextColor" /> </selector>
\ No newline at end of file diff --git a/packages/SystemUI/res/color/pin_delete_color.xml b/packages/SystemUI/res/color/pin_delete_color.xml index bb8b8e3f0582..7d4f1321d52f 100644 --- a/packages/SystemUI/res/color/pin_delete_color.xml +++ b/packages/SystemUI/res/color/pin_delete_color.xml @@ -15,5 +15,5 @@ ~ limitations under the License --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:alpha="0.61" android:color="?attr/bgProtectTextColor" /> + <item android:alpha="0.61" android:color="?attr/wallpaperTextColor" /> </selector>
\ No newline at end of file diff --git a/packages/SystemUI/res/color/pin_divider_color.xml b/packages/SystemUI/res/color/pin_divider_color.xml index ca5f43164b67..aff23171eee3 100644 --- a/packages/SystemUI/res/color/pin_divider_color.xml +++ b/packages/SystemUI/res/color/pin_divider_color.xml @@ -15,5 +15,5 @@ ~ limitations under the License --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:alpha="0.45" android:color="?attr/bgProtectSecondaryTextColor" /> + <item android:alpha="0.45" android:color="?attr/wallpaperTextColorSecondary" /> </selector>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/keyguard_bottom_area.xml b/packages/SystemUI/res/layout/keyguard_bottom_area.xml index 52441221e714..ddd8ef8eb9fc 100644 --- a/packages/SystemUI/res/layout/keyguard_bottom_area.xml +++ b/packages/SystemUI/res/layout/keyguard_bottom_area.xml @@ -39,7 +39,7 @@ android:layout_height="wrap_content" android:gravity="center_horizontal" android:textStyle="italic" - android:textColor="?attr/bgProtectSecondaryTextColor" + android:textColor="?attr/wallpaperTextColorSecondary" android:textAppearance="?android:attr/textAppearanceSmall" android:visibility="gone" /> @@ -49,7 +49,7 @@ android:layout_height="wrap_content" android:gravity="center_horizontal" android:textStyle="italic" - android:textColor="?attr/bgProtectSecondaryTextColor" + android:textColor="?attr/wallpaperTextColorSecondary" android:textAppearance="?android:attr/textAppearanceSmall" android:accessibilityLiveRegion="polite" /> @@ -69,7 +69,7 @@ android:src="@drawable/ic_camera_alt_24dp" android:scaleType="center" android:contentDescription="@string/accessibility_camera_button" - android:tint="?attr/bgProtectTextColor" /> + android:tint="?attr/wallpaperTextColor" /> <com.android.systemui.statusbar.KeyguardAffordanceView android:id="@+id/left_button" @@ -79,7 +79,7 @@ android:src="@drawable/ic_phone_24dp" android:scaleType="center" android:contentDescription="@string/accessibility_phone_button" - android:tint="?attr/bgProtectTextColor" /> + android:tint="?attr/wallpaperTextColor" /> <com.android.systemui.statusbar.phone.LockIcon android:id="@+id/lock_icon" @@ -89,7 +89,7 @@ android:src="@drawable/ic_lock_24dp" android:contentDescription="@string/accessibility_unlock_button" android:scaleType="center" - android:tint="?attr/bgProtectTextColor" /> + android:tint="?attr/wallpaperTextColor" /> <FrameLayout android:id="@+id/overlay_container" diff --git a/packages/SystemUI/res/layout/keyguard_status_bar.xml b/packages/SystemUI/res/layout/keyguard_status_bar.xml index 71a681c17683..7b30d6ae8717 100644 --- a/packages/SystemUI/res/layout/keyguard_status_bar.xml +++ b/packages/SystemUI/res/layout/keyguard_status_bar.xml @@ -63,7 +63,7 @@ android:gravity="center_vertical" android:ellipsize="marquee" android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="?attr/bgProtectSecondaryTextColor" + android:textColor="?attr/wallpaperTextColorSecondary" android:singleLine="true" /> </com.android.systemui.statusbar.phone.KeyguardStatusBarView> diff --git a/packages/SystemUI/res/layout/recents_empty.xml b/packages/SystemUI/res/layout/recents_empty.xml index 8048c6845c23..d7f058ce4a9d 100644 --- a/packages/SystemUI/res/layout/recents_empty.xml +++ b/packages/SystemUI/res/layout/recents_empty.xml @@ -23,8 +23,8 @@ android:drawableTop="@drawable/recents_empty" android:drawablePadding="25dp" android:textSize="16sp" - android:drawableTint="?attr/bgProtectTextColor" - android:textColor="?attr/bgProtectTextColor" + android:drawableTint="?attr/wallpaperTextColor" + android:textColor="?attr/wallpaperTextColor" android:text="@string/recents_empty_message" android:fontFamily="sans-serif" android:visibility="gone" />
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/recents_stack_action_button.xml b/packages/SystemUI/res/layout/recents_stack_action_button.xml index 10b43163cd62..4707a8ca843f 100644 --- a/packages/SystemUI/res/layout/recents_stack_action_button.xml +++ b/packages/SystemUI/res/layout/recents_stack_action_button.xml @@ -24,7 +24,7 @@ android:paddingBottom="12dp" android:text="@string/recents_stack_action_button_label" android:textSize="14sp" - android:textColor="?attr/bgProtectTextColor" + android:textColor="?attr/wallpaperTextColor" android:textAllCaps="true" android:shadowColor="#99000000" android:shadowDx="0" diff --git a/packages/SystemUI/res/layout/status_bar_no_notifications.xml b/packages/SystemUI/res/layout/status_bar_no_notifications.xml index ed4bc67f450a..0a25b697c84e 100644 --- a/packages/SystemUI/res/layout/status_bar_no_notifications.xml +++ b/packages/SystemUI/res/layout/status_bar_no_notifications.xml @@ -27,7 +27,7 @@ android:layout_height="64dp" android:paddingTop="28dp" android:gravity="top|center_horizontal" - android:textColor="?attr/bgProtectTextColor" + android:textColor="?attr/wallpaperTextColor" android:textSize="16sp" android:text="@string/empty_shade_text"/> </com.android.systemui.statusbar.EmptyShadeView> diff --git a/packages/SystemUI/res/layout/status_bar_notification_dismiss_all.xml b/packages/SystemUI/res/layout/status_bar_notification_dismiss_all.xml index eefa9bca0e42..8dc4cb4a4b93 100644 --- a/packages/SystemUI/res/layout/status_bar_notification_dismiss_all.xml +++ b/packages/SystemUI/res/layout/status_bar_notification_dismiss_all.xml @@ -30,6 +30,6 @@ android:focusable="true" android:contentDescription="@string/accessibility_clear_all" android:text="@string/clear_all_notifications_text" - android:textColor="?attr/bgProtectTextColor" + android:textColor="?attr/wallpaperTextColor" android:textAllCaps="true"/> </com.android.systemui.statusbar.DismissView> diff --git a/packages/SystemUI/res/values/attrs.xml b/packages/SystemUI/res/values/attrs.xml index 81f0138be67c..056008245563 100644 --- a/packages/SystemUI/res/values/attrs.xml +++ b/packages/SystemUI/res/values/attrs.xml @@ -127,7 +127,7 @@ <attr name="lightIconTheme" format="reference" /> <attr name="darkIconTheme" format="reference" /> - <attr name="bgProtectTextColor" format="color" /> - <attr name="bgProtectSecondaryTextColor" format="color" /> + <attr name="wallpaperTextColor" format="color" /> + <attr name="wallpaperTextColorSecondary" format="color" /> </resources> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index b61c5b55ee12..daed847c2ac3 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -41,8 +41,8 @@ <item name="android:windowShowWallpaper">true</item> <item name="android:windowDisablePreview">true</item> <item name="clearAllStyle">@style/ClearAllButtonDefaultMargins</item> - <item name="bgProtectTextColor">?android:attr/textColorPrimaryInverse</item> - <item name="bgProtectSecondaryTextColor">?android:attr/textColorSecondaryInverse</item> + <item name="wallpaperTextColor">?android:attr/textColorPrimaryInverse</item> + <item name="wallpaperTextColorSecondary">?android:attr/textColorSecondaryInverse</item> </style> <style name="ClearAllButtonDefaultMargins"> @@ -55,8 +55,8 @@ <!-- Performance optimized Recents theme (no wallpaper) --> <style name="RecentsTheme.NoWallpaper"> <item name="android:windowBackground">@android:color/black</item> - <item name="bgProtectTextColor">@android:color/white</item> - <item name="bgProtectSecondaryTextColor">@android:color/white</item> + <item name="wallpaperTextColor">@android:color/white</item> + <item name="wallpaperTextColorSecondary">@android:color/white</item> </style> <!-- Theme used for the activity that shows when the system forced an app to be resizable --> @@ -306,8 +306,8 @@ <style name="systemui_theme" parent="systemui_base"> <item name="lightIconTheme">@style/DualToneLightTheme</item> <item name="darkIconTheme">@style/DualToneDarkTheme</item> - <item name="bgProtectTextColor">?android:attr/textColorPrimaryInverse</item> - <item name="bgProtectSecondaryTextColor">?android:attr/textColorSecondaryInverse</item> + <item name="wallpaperTextColor">?android:attr/textColorPrimaryInverse</item> + <item name="wallpaperTextColorSecondary">?android:attr/textColorSecondaryInverse</item> <item name="android:colorControlHighlight">?android:attr/textColorSecondaryInverse</item> <item name="*android:lockPatternStyle">@style/LockPatternStyle</item> </style> diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java index 5005f9dd7db2..820a77359cf2 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java @@ -24,6 +24,8 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Color; import android.graphics.PorterDuff; +import android.os.Handler; +import android.os.Looper; import android.os.UserHandle; import android.support.v4.graphics.ColorUtils; import android.text.TextUtils; @@ -48,6 +50,7 @@ import java.util.Locale; public class KeyguardStatusView extends GridLayout { private static final boolean DEBUG = KeyguardConstants.DEBUG; private static final String TAG = "KeyguardStatusView"; + private static final int MARQUEE_DELAY_MS = 2000; private final LockPatternUtils mLockPatternUtils; private final AlarmManager mAlarmManager; @@ -59,6 +62,8 @@ public class KeyguardStatusView extends GridLayout { private ViewGroup mClockContainer; private ChargingView mBatteryDoze; private View mKeyguardStatusArea; + private Runnable mPendingMarqueeStart; + private Handler mHandler; private View[] mVisibleInDoze; private boolean mPulsing; @@ -112,9 +117,29 @@ public class KeyguardStatusView extends GridLayout { super(context, attrs, defStyle); mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); mLockPatternUtils = new LockPatternUtils(getContext()); + mHandler = new Handler(Looper.myLooper()); } private void setEnableMarquee(boolean enabled) { + if (DEBUG) Log.v(TAG, "Schedule setEnableMarquee: " + (enabled ? "Enable" : "Disable")); + if (enabled) { + if (mPendingMarqueeStart == null) { + mPendingMarqueeStart = () -> { + setEnableMarqueeImpl(true); + mPendingMarqueeStart = null; + }; + mHandler.postDelayed(mPendingMarqueeStart, MARQUEE_DELAY_MS); + } + } else { + if (mPendingMarqueeStart != null) { + mHandler.removeCallbacks(mPendingMarqueeStart); + mPendingMarqueeStart = null; + } + setEnableMarqueeImpl(false); + } + } + + private void setEnableMarqueeImpl(boolean enabled) { if (DEBUG) Log.v(TAG, (enabled ? "Enable" : "Disable") + " transport text marquee"); if (mAlarmStatusView != null) mAlarmStatusView.setSelected(enabled); if (mOwnerInfo != null) mOwnerInfo.setSelected(enabled); diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchState.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchState.java index dd3361ba899a..686b3bb9d127 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchState.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchState.java @@ -29,7 +29,7 @@ import java.io.PrintWriter; */ public class PipTouchState { private static final String TAG = "PipTouchHandler"; - private static final boolean DEBUG = true; + private static final boolean DEBUG = false; private ViewConfiguration mViewConfig; diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index fa16f8e5bd0e..f2ea6a683e95 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -337,7 +337,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD getWindow().getAttributes().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY; - mLastConfig = Utilities.getAppConfiguration(this); + mLastConfig = new Configuration(Utilities.getAppConfiguration(this)); mFocusTimerDuration = getResources().getInteger(R.integer.recents_auto_advance_duration); mIterateTrigger = new DozeTrigger(mFocusTimerDuration, new Runnable() { @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index a3e5e45a1ef7..3e183b657501 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -401,24 +401,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL && pm.resolveActivity(PHONE_INTENT, 0) != null; } - private boolean isCameraDisabledByDpm() { - final DevicePolicyManager dpm = - (DevicePolicyManager) getContext().getSystemService(Context.DEVICE_POLICY_SERVICE); - if (dpm != null && mStatusBar != null) { - try { - final int userId = ActivityManager.getService().getCurrentUser().id; - final int disabledFlags = dpm.getKeyguardDisabledFeatures(null, userId); - final boolean disabledBecauseKeyguardSecure = - (disabledFlags & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0 - && mStatusBar.isKeyguardSecure(); - return dpm.getCameraDisabled(null) || disabledBecauseKeyguardSecure; - } catch (RemoteException e) { - Log.e(TAG, "Can't get userId", e); - } - } - return false; - } - private void watchForCameraPolicyChanges() { final IntentFilter filter = new IntentFilter(); filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED); @@ -871,7 +853,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL @Override public IconState getIcon() { ResolveInfo resolved = resolveCameraIntent(); - mIconState.isVisible = !isCameraDisabledByDpm() && resolved != null + boolean isCameraDisabled = (mStatusBar != null) && !mStatusBar.isCameraAllowedByAdmin(); + mIconState.isVisible = !isCameraDisabled && resolved != null && getResources().getBoolean(R.bool.config_keyguardShowCameraAffordance) && mUserSetupComplete; mIconState.drawable = mContext.getDrawable(R.drawable.ic_camera_alt_24dp); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java index f7c2fc8633ab..c1581c835a9c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java @@ -333,7 +333,7 @@ public class KeyguardStatusBarView extends RelativeLayout } public void onOverlayChanged() { - @ColorInt int textColor = Utils.getColorAttr(mContext, R.attr.bgProtectTextColor); + @ColorInt int textColor = Utils.getColorAttr(mContext, R.attr.wallpaperTextColor); mCarrierLabel.setTextColor(textColor); mBatteryView.setFillColor(textColor); mIconManager.setTint(textColor); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index fc8b5c7187fc..0c62096cb931 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -2511,6 +2511,10 @@ public class NotificationPanelView extends PanelView implements * @param keyguardIsShowing whether keyguard is being shown */ public boolean canCameraGestureBeLaunched(boolean keyguardIsShowing) { + if (!mStatusBar.isCameraAllowedByAdmin()) { + return false; + } + ResolveInfo resolveInfo = mKeyguardBottomArea.resolveCameraIntent(); String packageToLaunch = (resolveInfo == null || resolveInfo.activityInfo == null) ? null : resolveInfo.activityInfo.packageName; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index ee5d1d7d555b..a8b1c91fc235 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -25,6 +25,7 @@ import android.content.Context; import android.graphics.Color; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.util.Log; import android.util.MathUtils; import android.view.View; import android.view.ViewGroup; @@ -102,6 +103,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, protected long mDurationOverride = -1; private long mAnimationDelay; private Runnable mOnAnimationFinished; + private boolean mDeferFinishedListener; private final Interpolator mInterpolator = new DecelerateInterpolator(); private boolean mDozing; private float mDozeInFrontAlpha; @@ -447,7 +449,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - if (mOnAnimationFinished != null) { + if (!mDeferFinishedListener && mOnAnimationFinished != null) { mOnAnimationFinished.run(); mOnAnimationFinished = null; } @@ -558,7 +560,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, float animEndValue = -1; if (previousAnimator != null) { if (animate || alpha == currentAlpha) { + // We are not done yet! Defer calling the finished listener. + if (animate) { + mDeferFinishedListener = true; + } previousAnimator.cancel(); + mDeferFinishedListener = false; } else { animEndValue = ViewState.getChildTag(scrim, TAG_END_ALPHA); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 0517b2833a91..4d3395d8e322 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -1,5 +1,3 @@ - - /* * Copyright (C) 2010 The Android Open Source Project * @@ -5269,6 +5267,18 @@ public class StatusBar extends SystemUI implements DemoMode, } } + boolean isCameraAllowedByAdmin() { + if (mDevicePolicyManager.getCameraDisabled(null, mCurrentUserId)) { + return false; + } else if (isKeyguardShowing() && isKeyguardSecure()) { + // Check if the admin has disabled the camera specifically for the keyguard + return (mDevicePolicyManager.getKeyguardDisabledFeatures(null, mCurrentUserId) + & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) == 0; + } + + return true; + } + public void notifyFpAuthModeChanged() { updateDozing(); } @@ -5292,6 +5302,10 @@ public class StatusBar extends SystemUI implements DemoMode, } public boolean isKeyguardShowing() { + if (mStatusBarKeyguardViewManager == null) { + Slog.i(TAG, "isKeyguardShowing() called before startKeyguard(), returning true"); + return true; + } return mStatusBarKeyguardViewManager.isShowing(); } @@ -5567,6 +5581,10 @@ public class StatusBar extends SystemUI implements DemoMode, private Set<String> mNonBlockablePkgs; + public boolean isDeviceInteractive() { + return mDeviceInteractive; + } + @Override // NotificationData.Environment public boolean isDeviceProvisioned() { return mDeviceProvisionedController.isDeviceProvisioned(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index be338de7676f..191b7a24b78f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -16,6 +16,10 @@ package com.android.systemui.statusbar.phone; +import static com.android.keyguard.KeyguardHostView.OnDismissAction; +import static com.android.systemui.statusbar.phone.FingerprintUnlockController.MODE_WAKE_AND_UNLOCK; +import static com.android.systemui.statusbar.phone.FingerprintUnlockController.MODE_WAKE_AND_UNLOCK_PULSING; + import android.content.ComponentCallbacks2; import android.content.Context; import android.os.Bundle; @@ -30,18 +34,15 @@ import android.view.WindowManagerGlobal; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; +import com.android.keyguard.LatencyTracker; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.DejankUtils; -import com.android.keyguard.LatencyTracker; import com.android.systemui.Dependency; import com.android.systemui.SystemUIFactory; import com.android.systemui.keyguard.DismissCallbackRegistry; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.RemoteInputController; -import static com.android.keyguard.KeyguardHostView.OnDismissAction; -import static com.android.systemui.statusbar.phone.FingerprintUnlockController.*; - import java.util.ArrayList; /** @@ -95,6 +96,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb protected boolean mLastRemoteInputActive; private boolean mLastDozing; private boolean mLastDeferScrimFadeOut; + private int mLastFpMode; private OnDismissAction mAfterKeyguardGoneAction; private final ArrayList<Runnable> mAfterKeyguardGoneRunnables = new ArrayList<>(); @@ -583,6 +585,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mLastRemoteInputActive = remoteInputActive; mLastDozing = mDozing; mLastDeferScrimFadeOut = mDeferScrimFadeOut; + mLastFpMode = mFingerprintUnlockController.getMode(); mStatusBar.onKeyguardViewManagerStatesUpdated(); } @@ -590,15 +593,20 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb * @return Whether the navigation bar should be made visible based on the current state. */ protected boolean isNavBarVisible() { - return (!(mShowing && !mOccluded) && !mDozing || mBouncer.isShowing() || mRemoteInputActive) - && !mDeferScrimFadeOut; + int fpMode = mFingerprintUnlockController.getMode(); + boolean keyguardShowing = mShowing && !mOccluded; + boolean hideWhileDozing = mDozing && fpMode != MODE_WAKE_AND_UNLOCK_PULSING; + return (!keyguardShowing && !hideWhileDozing || mBouncer.isShowing() + || mRemoteInputActive) && !mDeferScrimFadeOut; } /** * @return Whether the navigation bar was made visible based on the last known state. */ protected boolean getLastNavBarVisible() { - return (!(mLastShowing && !mLastOccluded) && !mLastDozing || mLastBouncerShowing + boolean keyguardShowing = mLastShowing && !mLastOccluded; + boolean hideWhileDozing = mLastDozing && mLastFpMode != MODE_WAKE_AND_UNLOCK_PULSING; + return (!keyguardShowing && !hideWhileDozing || mLastBouncerShowing || mLastRemoteInputActive) && !mLastDeferScrimFadeOut; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrustDrawable.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrustDrawable.java index e8a456e9bf60..028da86dea34 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrustDrawable.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrustDrawable.java @@ -83,7 +83,7 @@ public class TrustDrawable extends Drawable { mPaint = new Paint(); mPaint.setStyle(Paint.Style.STROKE); - mPaint.setColor(Utils.getColorAttr(context, R.attr.bgProtectTextColor)); + mPaint.setColor(Utils.getColorAttr(context, R.attr.wallpaperTextColor)); mPaint.setAntiAlias(true); mPaint.setStrokeWidth(mThickness); } diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java index eaad2f9bd457..103eb6ec927f 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java @@ -48,8 +48,10 @@ import android.view.accessibility.AccessibilityManager; import com.android.internal.annotations.GuardedBy; import com.android.systemui.Dumpable; import com.android.systemui.R; +import com.android.systemui.SysUiServiceProvider; import com.android.systemui.plugins.VolumeDialogController; import com.android.systemui.qs.tiles.DndTile; +import com.android.systemui.statusbar.phone.StatusBar; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -89,11 +91,12 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa private final W mWorker; private final Context mContext; private AudioManager mAudio; + protected StatusBar mStatusBar; private final NotificationManager mNoMan; private final SettingObserver mObserver; private final Receiver mReceiver = new Receiver(); private final MediaSessions mMediaSessions; - private final C mCallbacks = new C(); + protected C mCallbacks = new C(); private final State mState = new State(); private final MediaSessionsCallbacks mMediaSessionsCallbacksW = new MediaSessionsCallbacks(); private final Vibrator mVibrator; @@ -123,6 +126,7 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa mReceiver.init(); mVibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); mHasVibrator = mVibrator != null && mVibrator.hasVibrator(); + updateStatusBar(); boolean accessibilityVolumeStreamActive = context.getSystemService( AccessibilityManager.class).isAccessibilityVolumeStreamActive(); @@ -326,8 +330,17 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa return changed; } - private boolean onVolumeChangedW(int stream, int flags) { - final boolean showUI = (flags & AudioManager.FLAG_SHOW_UI) != 0; + private void updateStatusBar() { + if (mStatusBar == null) { + mStatusBar = SysUiServiceProvider.getComponent(mContext, StatusBar.class); + } + } + + boolean onVolumeChangedW(int stream, int flags) { + updateStatusBar(); + + final boolean showUI = (mStatusBar != null && mStatusBar.isDeviceInteractive()) && + ((flags & AudioManager.FLAG_SHOW_UI) != 0); final boolean fromKey = (flags & AudioManager.FLAG_FROM_KEY) != 0; final boolean showVibrateHint = (flags & AudioManager.FLAG_SHOW_VIBRATE_HINT) != 0; final boolean showSilentHint = (flags & AudioManager.FLAG_SHOW_SILENT_HINT) != 0; @@ -638,7 +651,7 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa } } - private final class C implements Callbacks { + class C implements Callbacks { private final HashMap<Callbacks, Handler> mCallbackMap = new HashMap<>(); public void add(Callbacks callback, Handler handler) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogControllerImplTest.java new file mode 100644 index 000000000000..8060f5beb9b2 --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogControllerImplTest.java @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.volume; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import android.content.Context; +import android.media.AudioManager; +import android.support.test.filters.SmallTest; +import com.android.systemui.SysuiTestCase; +import com.android.systemui.statusbar.phone.StatusBar; + +import org.junit.Before; +import org.junit.Test; + +@SmallTest +public class VolumeDialogControllerImplTest extends SysuiTestCase { + + TestableVolumeDialogControllerImpl mVolumeController; + VolumeDialogControllerImpl.C mCallback; + StatusBar mStatusBar; + + @Before + public void setup() throws Exception { + mCallback = mock(VolumeDialogControllerImpl.C.class); + mStatusBar = mock(StatusBar.class); + mVolumeController = new TestableVolumeDialogControllerImpl(mContext, mCallback, mStatusBar); + } + + @Test + public void testVolumeChangeW_deviceNotInteractiveAOD() { + when(mStatusBar.isDeviceInteractive()).thenReturn(false); + mVolumeController.onVolumeChangedW(0, AudioManager.FLAG_SHOW_UI); + verify(mCallback, never()).onShowRequested(Events.SHOW_REASON_VOLUME_CHANGED); + } + + @Test + public void testVolumeChangeW_deviceInteractive() { + when(mStatusBar.isDeviceInteractive()).thenReturn(true); + mVolumeController.onVolumeChangedW(0, AudioManager.FLAG_SHOW_UI); + verify(mCallback, times(1)).onShowRequested(Events.SHOW_REASON_VOLUME_CHANGED); + } + + static class TestableVolumeDialogControllerImpl extends VolumeDialogControllerImpl { + public TestableVolumeDialogControllerImpl(Context context, C callback, StatusBar s) { + super(context); + mCallbacks = callback; + mStatusBar = s; + } + } + +} diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java index a31c33e4ab91..4f04066c6076 100644 --- a/services/core/java/com/android/server/am/ActivityStarter.java +++ b/services/core/java/com/android/server/am/ActivityStarter.java @@ -1640,6 +1640,16 @@ class ActivityStarter { REPARENT_MOVE_STACK_TO_FRONT, ANIMATE, DEFER_RESUME, "reparentToDisplay"); mMovedToFront = true; + } else if (launchStack.getStackId() == StackId.HOME_STACK_ID + && mTargetStack.getStackId() != StackId.HOME_STACK_ID) { + // It is possible for the home activity to be in another stack initially. + // For example, the activity may have been initially started with an intent + // which placed it in the fullscreen stack. To ensure the proper handling of + // the activity based on home stack assumptions, we must move it over. + intentActivity.getTask().reparent(launchStack.mStackId, ON_TOP, + REPARENT_MOVE_STACK_TO_FRONT, ANIMATE, DEFER_RESUME, + "reparentingHome"); + mMovedToFront = true; } mOptions = null; diff --git a/services/core/java/com/android/server/am/KeyguardController.java b/services/core/java/com/android/server/am/KeyguardController.java index a46c85170ba2..d10f9fb44f2a 100644 --- a/services/core/java/com/android/server/am/KeyguardController.java +++ b/services/core/java/com/android/server/am/KeyguardController.java @@ -144,6 +144,7 @@ class KeyguardController { failCallback(callback); return; } + Slog.i(TAG, "Activity requesting to dismiss Keyguard: " + activityRecord); mWindowManager.dismissKeyguard(callback); } diff --git a/services/core/java/com/android/server/content/SyncJobService.java b/services/core/java/com/android/server/content/SyncJobService.java index 1f02ebfc4972..07f04b1b11a3 100644 --- a/services/core/java/com/android/server/content/SyncJobService.java +++ b/services/core/java/com/android/server/content/SyncJobService.java @@ -76,7 +76,7 @@ public class SyncJobService extends JobService { m.what = SyncManager.SyncHandler.MESSAGE_START_SYNC; SyncOperation op = SyncOperation.maybeCreateFromJobExtras(params.getExtras()); - mLogger.log("onStopJob() jobid=", params.getJobId(), " op=", op); + mLogger.log("onStartJob() jobid=", params.getJobId(), " op=", op); if (op == null) { Slog.e(TAG, "Got invalid job " + params.getJobId()); @@ -131,4 +131,4 @@ public class SyncJobService extends JobService { } } } -}
\ No newline at end of file +} diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java index 601dd9454118..83bb17eeaf3c 100644 --- a/services/core/java/com/android/server/location/GnssLocationProvider.java +++ b/services/core/java/com/android/server/location/GnssLocationProvider.java @@ -2516,6 +2516,7 @@ public class GnssLocationProvider implements LocationProviderInterface { @Override public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { StringBuilder s = new StringBuilder(); + s.append(" mStarted=").append(mStarted).append('\n'); s.append(" mFixInterval=").append(mFixInterval).append('\n'); s.append(" mDisableGps (battery saver mode)=").append(mDisableGps).append('\n'); s.append(" mEngineCapabilities=0x").append(Integer.toHexString(mEngineCapabilities)); diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index a7eb2c6a273b..1f684aa1770d 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -1080,7 +1080,7 @@ public class NotificationManagerService extends SystemService { mUsageStats = us; } - // TODO: Tests should call onStart instead once the methods above are removed. + // TODO: All tests should use this init instead of the one-off setters above. @VisibleForTesting void init(Looper looper, IPackageManager packageManager, PackageManager packageManagerClient, LightsManager lightsManager, NotificationListeners notificationListeners, @@ -1211,6 +1211,37 @@ public class NotificationManagerService extends SystemService { mUserProfiles.updateCache(getContext()); listenForCallState(); + mSettingsObserver = new SettingsObserver(mHandler); + + mArchive = new Archive(resources.getInteger( + R.integer.config_notificationServiceArchiveSize)); + + mIsTelevision = mPackageManagerClient.hasSystemFeature(FEATURE_LEANBACK) + || mPackageManagerClient.hasSystemFeature(FEATURE_TELEVISION); + } + + @Override + public void onStart() { + SnoozeHelper snoozeHelper = new SnoozeHelper(getContext(), new SnoozeHelper.Callback() { + @Override + public void repost(int userId, NotificationRecord r) { + try { + if (DBG) { + Slog.d(TAG, "Reposting " + r.getKey()); + } + enqueueNotificationInternal(r.sbn.getPackageName(), r.sbn.getOpPkg(), + r.sbn.getUid(), r.sbn.getInitialPid(), r.sbn.getTag(), r.sbn.getId(), + r.sbn.getNotification(), userId); + } catch (Exception e) { + Slog.e(TAG, "Cannot un-snooze notification", e); + } + } + }, mUserProfiles); + + init(Looper.myLooper(), AppGlobals.getPackageManager(), getContext().getPackageManager(), + getLocalService(LightsManager.class), new NotificationListeners(), + null, snoozeHelper, new NotificationUsageStats(getContext())); + // register for various Intents IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_SCREEN_ON); @@ -1248,36 +1279,6 @@ public class NotificationManagerService extends SystemService { timeoutFilter.addDataScheme(SCHEME_TIMEOUT); getContext().registerReceiver(mNotificationTimeoutReceiver, timeoutFilter); - mSettingsObserver = new SettingsObserver(mHandler); - - mArchive = new Archive(resources.getInteger( - R.integer.config_notificationServiceArchiveSize)); - - mIsTelevision = mPackageManagerClient.hasSystemFeature(FEATURE_LEANBACK) - || mPackageManagerClient.hasSystemFeature(FEATURE_TELEVISION); - } - - @Override - public void onStart() { - SnoozeHelper snoozeHelper = new SnoozeHelper(getContext(), new SnoozeHelper.Callback() { - @Override - public void repost(int userId, NotificationRecord r) { - try { - if (DBG) { - Slog.d(TAG, "Reposting " + r.getKey()); - } - enqueueNotificationInternal(r.sbn.getPackageName(), r.sbn.getOpPkg(), - r.sbn.getUid(), r.sbn.getInitialPid(), r.sbn.getTag(), r.sbn.getId(), - r.sbn.getNotification(), userId); - } catch (Exception e) { - Slog.e(TAG, "Cannot un-snooze notification", e); - } - } - }, mUserProfiles); - - init(Looper.myLooper(), AppGlobals.getPackageManager(), getContext().getPackageManager(), - getLocalService(LightsManager.class), new NotificationListeners(), - null, snoozeHelper, new NotificationUsageStats(getContext())); publishBinderService(Context.NOTIFICATION_SERVICE, mService); publishLocalService(NotificationManagerInternal.class, mInternalService); } diff --git a/services/core/java/com/android/server/wm/AppWindowContainerController.java b/services/core/java/com/android/server/wm/AppWindowContainerController.java index 86e130d723d8..a6ffe83c366e 100644 --- a/services/core/java/com/android/server/wm/AppWindowContainerController.java +++ b/services/core/java/com/android/server/wm/AppWindowContainerController.java @@ -685,7 +685,10 @@ public class AppWindowContainerController if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, "Schedule remove starting " + mContainer + " startingWindow=" + mContainer.startingWindow); - mHandler.post(mRemoveStartingWindow); + + // Use the same thread to remove the window as we used to add it, as otherwise we end up + // with things in the view hierarchy being called from different threads. + mService.mAnimationHandler.post(mRemoveStartingWindow); } } diff --git a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java index 82c862f6a6a8..690989251f61 100644 --- a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java +++ b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java @@ -233,7 +233,7 @@ class WindowSurfacePlacer { */ int handleAppTransitionReadyLocked() { int appsCount = mService.mOpeningApps.size(); - if (!transitionGoodToGo(appsCount)) { + if (!transitionGoodToGo(appsCount, mTempTransitionReasons)) { return 0; } Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "AppTransitionReady"); @@ -375,6 +375,9 @@ class WindowSurfacePlacer { true /*updateInputWindows*/); mService.mFocusMayChange = false; + mService.mH.obtainMessage(NOTIFY_APP_TRANSITION_STARTING, + mTempTransitionReasons.clone()).sendToTarget(); + Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER); return layoutRedo | FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_CONFIG; @@ -499,7 +502,7 @@ class WindowSurfacePlacer { } } - private boolean transitionGoodToGo(int appsCount) { + private boolean transitionGoodToGo(int appsCount, SparseIntArray outReasons) { if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "Checking " + appsCount + " opening apps (frozen=" + mService.mDisplayFrozen + " timeout=" @@ -508,7 +511,7 @@ class WindowSurfacePlacer { mService.mAnimator.getScreenRotationAnimationLocked( Display.DEFAULT_DISPLAY); - final SparseIntArray reasons = mTempTransitionReasons; + outReasons.clear(); if (!mService.mAppTransition.isTimeout()) { // Imagine the case where we are changing orientation due to an app transition, but a previous // orientation change is still in progress. We won't process the orientation change @@ -542,10 +545,10 @@ class WindowSurfacePlacer { final TaskStack stack = wtoken.getStack(); final int stackId = stack != null ? stack.mStackId : INVALID_STACK_ID; if (allDrawn) { - reasons.put(stackId, drawnBeforeRestoring ? APP_TRANSITION_WINDOWS_DRAWN + outReasons.put(stackId, drawnBeforeRestoring ? APP_TRANSITION_WINDOWS_DRAWN : APP_TRANSITION_SAVED_SURFACE); } else { - reasons.put(stackId, wtoken.startingData instanceof SplashScreenStartingData + outReasons.put(stackId, wtoken.startingData instanceof SplashScreenStartingData ? APP_TRANSITION_SPLASH_SCREEN : APP_TRANSITION_SNAPSHOT); } @@ -569,13 +572,10 @@ class WindowSurfacePlacer { boolean wallpaperReady = !mWallpaperControllerLocked.isWallpaperVisible() || mWallpaperControllerLocked.wallpaperTransitionReady(); if (wallpaperReady) { - mService.mH.obtainMessage(NOTIFY_APP_TRANSITION_STARTING, reasons.clone()) - .sendToTarget(); return true; } return false; } - mService.mH.obtainMessage(NOTIFY_APP_TRANSITION_STARTING, reasons.clone()).sendToTarget(); return true; } diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp index edd7d537ad9d..4fb2ae368ae2 100644 --- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp +++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp @@ -1523,6 +1523,10 @@ static jstring android_location_GnssLocationProvider_get_internal_state(JNIEnv* << " satellites:: " << std::endl; } + internalState << "constellation: 1=GPS, 2=SBAS, 3=GLO, 4=QZSS, 5=BDS, 6=GAL; " + << "ephemerisType: 0=Eph, 1=Alm, 2=?; " + << "ephemerisSource: 0=Demod, 1=Supl, 2=Server, 3=?; " + << "ephemerisHealth: 0=Good, 1=Bad, 2=?" << std::endl; for (size_t i = 0; i < data.satelliteDataArray.size(); i++) { internalState << "svid: " << data.satelliteDataArray[i].svid << ", constellation: " diff --git a/services/core/jni/com_android_server_power_PowerManagerService.cpp b/services/core/jni/com_android_server_power_PowerManagerService.cpp index 23e3f67fd4bf..3ce9916d0943 100644 --- a/services/core/jni/com_android_server_power_PowerManagerService.cpp +++ b/services/core/jni/com_android_server_power_PowerManagerService.cpp @@ -63,7 +63,7 @@ std::mutex gPowerHalMutex; static nsecs_t gLastEventTime[USER_ACTIVITY_EVENT_LAST + 1]; // Throttling interval for user activity calls. -static const nsecs_t MIN_TIME_BETWEEN_USERACTIVITIES = 500 * 1000000L; // 500ms +static const nsecs_t MIN_TIME_BETWEEN_USERACTIVITIES = 100 * 1000000L; // 100ms // ---------------------------------------------------------------------------- @@ -103,19 +103,6 @@ static void processReturn(const Return<void> &ret, const char* functionName) { } void android_server_PowerManagerService_userActivity(nsecs_t eventTime, int32_t eventType) { - // Tell the power HAL when user activity occurs. - gPowerHalMutex.lock(); - if (getPowerHal()) { - Return<void> ret; - if (gPowerHalV1_1 != nullptr) { - ret = gPowerHalV1_1->powerHintAsync(PowerHint::INTERACTION, 0); - } else { - ret = gPowerHalV1_0->powerHint(PowerHint::INTERACTION, 0); - } - processReturn(ret, "powerHint"); - } - gPowerHalMutex.unlock(); - if (gPowerManagerServiceObj) { // Throttle calls into user activity by event type. // We're a little conservative about argument checking here in case the caller @@ -130,6 +117,21 @@ void android_server_PowerManagerService_userActivity(nsecs_t eventTime, int32_t return; } gLastEventTime[eventType] = eventTime; + + + // Tell the power HAL when user activity occurs. + gPowerHalMutex.lock(); + if (getPowerHal()) { + Return<void> ret; + if (gPowerHalV1_1 != nullptr) { + ret = gPowerHalV1_1->powerHintAsync(PowerHint::INTERACTION, 0); + } else { + ret = gPowerHalV1_0->powerHint(PowerHint::INTERACTION, 0); + } + processReturn(ret, "powerHint"); + } + gPowerHalMutex.unlock(); + } JNIEnv* env = AndroidRuntime::getJNIEnv(); diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index f6deb0a07b26..3821b9cecaf6 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -1066,6 +1066,13 @@ public class CarrierConfigManager { "carrier_app_no_wake_signal_config"; /** + * Default value for {@link Settings.Global#DATA_ROAMING} + * @hide + */ + public static final String KEY_CARRIER_DEFAULT_DATA_ROAMING_ENABLED_BOOL = + "carrier_default_data_roaming_enabled_bool"; + + /** * Determines whether the carrier supports making non-emergency phone calls while the phone is * in emergency callback mode. Default value is {@code true}, meaning that non-emergency calls * are allowed in emergency callback mode. @@ -1632,6 +1639,7 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_CARRIER_NAME_OVERRIDE_BOOL, false); sDefaults.putString(KEY_CARRIER_NAME_STRING, ""); sDefaults.putBoolean(KEY_SUPPORT_DIRECT_FDN_DIALING_BOOL, false); + sDefaults.putBoolean(KEY_CARRIER_DEFAULT_DATA_ROAMING_ENABLED_BOOL, false); // MMS defaults sDefaults.putBoolean(KEY_MMS_ALIAS_ENABLED_BOOL, false); diff --git a/tests/Internal/src/android/app/WallpaperColorsTest.java b/tests/Internal/src/android/app/WallpaperColorsTest.java index 5bbd82bea3de..fb529b936e5c 100644 --- a/tests/Internal/src/android/app/WallpaperColorsTest.java +++ b/tests/Internal/src/android/app/WallpaperColorsTest.java @@ -77,4 +77,16 @@ public class WallpaperColorsTest { Assert.assertFalse("Light surface shouldn't support dark text " + "when it contains dark pixels", supportsDarkText); } + + /** + * WallpaperColors should not recycle bitmaps that it didn't create. + */ + @Test + public void wallpaperRecycleBitmapTest() { + Bitmap image = Bitmap.createBitmap(300, 300, Bitmap.Config.ARGB_8888); + WallpaperColors.fromBitmap(image); + Canvas canvas = new Canvas(); + // This would crash: + canvas.drawBitmap(image, 0, 0, new Paint()); + } } |