diff options
40 files changed, 245 insertions, 86 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/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/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/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 ee14f3df5273..ef16ebaf9cf5 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml @@ -44,7 +44,7 @@ android:layout_gravity="center_horizontal" android:layout_centerHorizontal="true" android:layout_alignParentTop="true" - android:textColor="?attr/bgProtectTextColor" + android:textColor="?attr/wallpaperTextColor" android:singleLine="true" style="@style/widget_big_thin" android:format12Hour="@string/keyguard_widget_12_hours_format" @@ -77,7 +77,7 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/date_owner_info_margin" android:layout_centerHorizontal="true" - android:textColor="?attr/bgProtectSecondaryTextColor" + android:textColor="?attr/wallpaperTextColorSecondary" android:textSize="@dimen/widget_label_font_size" android:letterSpacing="0.05" android:ellipsize="marquee" 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/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/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/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/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/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()); + } } |