From 2fde8d8c2aa154d1636f1c2ad8d1580b1e57ea92 Mon Sep 17 00:00:00 2001 From: Arc Wang Date: Wed, 7 Apr 2021 21:31:47 +0800 Subject: [PATCH 01/10] Use ConstraintLayut to improve UI of storage items - To prevent title overlaps summary. - Align text base line of title & summary. - Remove deprecated attribute - fadingEdge. Bug: 184710253 Test: manual visual Change-Id: I2a21ec31b059b89450ce40daee9ed28064ee8666 --- res/layout/storage_item.xml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/res/layout/storage_item.xml b/res/layout/storage_item.xml index cefb399ec2b..6de2d510b17 100644 --- a/res/layout/storage_item.xml +++ b/res/layout/storage_item.xml @@ -15,6 +15,7 @@ --> - + android:layout_height="wrap_content"> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toStartOf="@android:id/summary"/> + app:layout_constraintBaseline_toBaselineOf="@android:id/title" + app:layout_constraintEnd_toEndOf="parent"/> - + From 5c2b1404831d737a0859619713f69f8428580bb8 Mon Sep 17 00:00:00 2001 From: SongFerngWang Date: Fri, 9 Apr 2021 18:31:02 +0800 Subject: [PATCH 02/10] The Network Select shows wrong operator name It get the empty subscriptionInfoList from SubscriptionManager#getAccessibleSubscriptionInfoList, so the UI shows default subId's operator. Since this item appears, when sim is active, using getActiveSubscriptionInfoList is enough. - https://screenshot.googleplex.com/9aHtDVpnYQBsiQr Bug: 182020952 Test: atest MobileNetworkUtilsTest atest OpenNetworkSelectPagePreferenceControllerTest Change-Id: I0d86ec41236a0d1be657ccd57fd0cf90f96b8b89 --- .../settings/network/telephony/MobileNetworkUtils.java | 8 ++------ .../network/telephony/MobileNetworkUtilsTest.java | 2 -- .../OpenNetworkSelectPagePreferenceControllerTest.java | 2 -- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/com/android/settings/network/telephony/MobileNetworkUtils.java b/src/com/android/settings/network/telephony/MobileNetworkUtils.java index 0834632a0dc..78d12378c0b 100644 --- a/src/com/android/settings/network/telephony/MobileNetworkUtils.java +++ b/src/com/android/settings/network/telephony/MobileNetworkUtils.java @@ -648,12 +648,8 @@ public class MobileNetworkUtils { return getOperatorNameFromTelephonyManager(context); } - private static SubscriptionInfo getSubscriptionInfo(SubscriptionManager subManager, - int subId) { - List subInfos = subManager.getAccessibleSubscriptionInfoList(); - if (subInfos == null) { - subInfos = subManager.getActiveSubscriptionInfoList(); - } + private static SubscriptionInfo getSubscriptionInfo(SubscriptionManager subManager, int subId) { + List subInfos = subManager.getActiveSubscriptionInfoList(); if (subInfos == null) { return null; } diff --git a/tests/unit/src/com/android/settings/network/telephony/MobileNetworkUtilsTest.java b/tests/unit/src/com/android/settings/network/telephony/MobileNetworkUtilsTest.java index 028b224123a..fec7ad3d777 100644 --- a/tests/unit/src/com/android/settings/network/telephony/MobileNetworkUtilsTest.java +++ b/tests/unit/src/com/android/settings/network/telephony/MobileNetworkUtilsTest.java @@ -132,8 +132,6 @@ public class MobileNetworkUtilsTest { when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn( Arrays.asList(mSubscriptionInfo1, mSubscriptionInfo2)); - when(mSubscriptionManager.getAccessibleSubscriptionInfoList()).thenReturn( - Arrays.asList(mSubscriptionInfo1, mSubscriptionInfo2)); when(mTelephonyManager.getNetworkOperatorName()).thenReturn( PLMN_FROM_TELEPHONY_MANAGER_API); diff --git a/tests/unit/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceControllerTest.java index 0d20140fba6..f7e311131ce 100644 --- a/tests/unit/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceControllerTest.java +++ b/tests/unit/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceControllerTest.java @@ -88,8 +88,6 @@ public class OpenNetworkSelectPagePreferenceControllerTest { when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn( Arrays.asList(mSubscriptionInfo)); - when(mSubscriptionManager.getAccessibleSubscriptionInfoList()).thenReturn( - Arrays.asList(mSubscriptionInfo)); when(mTelephonyManager.getNetworkOperatorName()).thenReturn(OPERATOR_NAME); From 688fa772b9867ae66643eed9f7101584d9f58971 Mon Sep 17 00:00:00 2001 From: Weng Su Date: Fri, 9 Apr 2021 23:10:24 +0800 Subject: [PATCH 03/10] Modify Wi-Fi network details settings to restricted style - Show restricted text in guest mode - Screenshot: https://screenshot.googleplex.com/Q5tbzn67EJigpVJ Bug: 177573895 Test: manual test make RunSettingsRoboTests ROBOTEST_FILTER=WifiNetworkDetailsFragment2Test Change-Id: I64c8d82518d47c7f96802f505efa380c63b9e10c --- .../details2/WifiNetworkDetailsFragment2.java | 48 +++++++++++++++++-- .../WifiNetworkDetailsFragment2Test.java | 41 ++++++++++++++++ 2 files changed, 86 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/wifi/details2/WifiNetworkDetailsFragment2.java b/src/com/android/settings/wifi/details2/WifiNetworkDetailsFragment2.java index 104761f7c88..6bc510d6b16 100644 --- a/src/com/android/settings/wifi/details2/WifiNetworkDetailsFragment2.java +++ b/src/com/android/settings/wifi/details2/WifiNetworkDetailsFragment2.java @@ -23,6 +23,7 @@ import android.app.settings.SettingsEnums; import android.content.Context; import android.net.ConnectivityManager; import android.net.wifi.WifiManager; +import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; @@ -40,7 +41,7 @@ import androidx.preference.PreferenceScreen; import com.android.settings.R; import com.android.settings.Utils; -import com.android.settings.dashboard.DashboardFragment; +import com.android.settings.dashboard.RestrictedDashboardFragment; import com.android.settings.overlay.FeatureFactory; import com.android.settings.wifi.WifiConfigUiBase2; import com.android.settings.wifi.WifiDialog2; @@ -62,7 +63,7 @@ import java.util.List; *

The key of {@link WifiEntry} should be saved to the intent Extras when launching this class * in order to properly render this page. */ -public class WifiNetworkDetailsFragment2 extends DashboardFragment implements +public class WifiNetworkDetailsFragment2 extends RestrictedDashboardFragment implements WifiDialog2.WifiDialog2Listener { private static final String TAG = "WifiNetworkDetailsFrg2"; @@ -75,6 +76,8 @@ public class WifiNetworkDetailsFragment2 extends DashboardFragment implements // Interval between initiating SavedNetworkTracker scans private static final long SCAN_INTERVAL_MILLIS = 10_000; + @VisibleForTesting + boolean mIsUiRestricted; @VisibleForTesting NetworkDetailsTracker mNetworkDetailsTracker; private HandlerThread mWorkerThread; @@ -83,6 +86,34 @@ public class WifiNetworkDetailsFragment2 extends DashboardFragment implements @VisibleForTesting List mControllers; + public WifiNetworkDetailsFragment2() { + super(UserManager.DISALLOW_CONFIG_WIFI); + } + + @Override + public void onCreate(Bundle icicle) { + super.onCreate(icicle); + setIfOnlyAvailableForAdmins(true); + mIsUiRestricted = isUiRestricted(); + } + + @Override + public void onStart() { + super.onStart(); + if (mIsUiRestricted) { + restrictUi(); + } + } + + @VisibleForTesting + void restrictUi() { + clearWifiEntryCallback(); + if (!isUiRestrictedByOnlyAdmin()) { + getEmptyTextView().setText(R.string.wifi_empty_list_user_restricted); + } + getPreferenceScreen().removeAll(); + } + @Override public void onDestroy() { mWorkerThread.quit(); @@ -126,7 +157,7 @@ public class WifiNetworkDetailsFragment2 extends DashboardFragment implements @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - if (isEditable()) { + if (!mIsUiRestricted && isEditable()) { MenuItem item = menu.add(0, Menu.FIRST, 0, R.string.wifi_modify); item.setIcon(com.android.internal.R.drawable.ic_mode_edit); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); @@ -255,6 +286,17 @@ public class WifiNetworkDetailsFragment2 extends DashboardFragment implements getArguments().getString(KEY_CHOSEN_WIFIENTRY_KEY)); } + private void clearWifiEntryCallback() { + if (mNetworkDetailsTracker == null) { + return; + } + final WifiEntry wifiEntry = mNetworkDetailsTracker.getWifiEntry(); + if (wifiEntry == null) { + return; + } + wifiEntry.setListener(null); + } + private boolean isEditable() { if (mNetworkDetailsTracker == null) { return false; diff --git a/tests/robotests/src/com/android/settings/wifi/details2/WifiNetworkDetailsFragment2Test.java b/tests/robotests/src/com/android/settings/wifi/details2/WifiNetworkDetailsFragment2Test.java index 66b5bcb9bcc..fdd6295ab65 100644 --- a/tests/robotests/src/com/android/settings/wifi/details2/WifiNetworkDetailsFragment2Test.java +++ b/tests/robotests/src/com/android/settings/wifi/details2/WifiNetworkDetailsFragment2Test.java @@ -32,6 +32,7 @@ import android.app.settings.SettingsEnums; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; +import android.widget.TextView; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; @@ -110,6 +111,41 @@ public class WifiNetworkDetailsFragment2Test { verify(mMenu, never()).add(anyInt(), anyInt(), anyInt(), eq(R.string.wifi_modify)); } + @Test + public void onCreateOptionsMenu_uiRestricted_shouldNotAddEditMenu() { + mFragment.mIsUiRestricted = true; + + mFragment.onCreateOptionsMenu(mMenu, mock(MenuInflater.class)); + + verify(mMenu, never()).add(anyInt(), anyInt(), anyInt(), eq(R.string.wifi_modify)); + } + + @Test + public void restrictUi_shouldShowRestrictedText() { + final FakeFragment fragment = spy(new FakeFragment()); + final PreferenceScreen screen = mock(PreferenceScreen.class); + final TextView restrictedText = mock(TextView.class); + doReturn(screen).when(fragment).getPreferenceScreen(); + doReturn(false).when(fragment).isUiRestrictedByOnlyAdmin(); + doReturn(restrictedText).when(fragment).getEmptyTextView(); + + fragment.restrictUi(); + + verify(restrictedText).setText(anyInt()); + } + + @Test + public void restrictUi_shouldRemoveAllPreferences() { + final FakeFragment fragment = spy(new FakeFragment()); + final PreferenceScreen screen = mock(PreferenceScreen.class); + doReturn(screen).when(fragment).getPreferenceScreen(); + doReturn(true).when(fragment).isUiRestrictedByOnlyAdmin(); + + fragment.restrictUi(); + + verify(screen).removeAll(); + } + @Test public void refreshPreferences_controllerShouldUpdateStateAndDisplayPreference() { final FakeFragment fragment = spy(new FakeFragment()); @@ -136,6 +172,11 @@ public class WifiNetworkDetailsFragment2Test { public void addPreferenceController(AbstractPreferenceController controller) { super.addPreferenceController(controller); } + + @Override + public boolean isUiRestrictedByOnlyAdmin() { + return super.isUiRestrictedByOnlyAdmin(); + } } public class TestController extends BasePreferenceController { From 2c955bbae2b68005746827c9dd86568ac9197043 Mon Sep 17 00:00:00 2001 From: Chloris Kuo Date: Fri, 19 Mar 2021 07:00:45 -0700 Subject: [PATCH 04/10] NAS Setting Migration Change NAS setting to a toggle setting and move the settings to Notifications/General Bug: 173106358 Test: tested manually on device, make RunSettingsRoboTests Change-Id: I1ba1214511dceea6faf5fb39692d920e761b33d8 --- AndroidManifest.xml | 2 +- res/values/strings.xml | 15 ++- res/xml/configure_notification_settings.xml | 5 + .../configure_notification_settings_v2.xml | 6 + res/xml/special_access.xml | 7 -- .../ConfigureNotificationSettings.java | 14 +++ .../NotificationAssistantDialogFragment.java | 71 +++++++++++ ...ficationAssistantPreferenceController.java | 70 +++++++---- .../notification/NotificationBackend.java | 19 ++- ...tificationAssistantDialogFragmentTest.java | 69 +++++++++++ ...tionAssistantPreferenceControllerTest.java | 112 ++++++++++++------ 11 files changed, 315 insertions(+), 75 deletions(-) create mode 100644 src/com/android/settings/notification/NotificationAssistantDialogFragment.java create mode 100644 tests/robotests/src/com/android/settings/notification/NotificationAssistantDialogFragmentTest.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index ce80fc5c403..2e7673eece1 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2631,7 +2631,7 @@ + android:value="com.android.settings.notification.ConfigureNotificationSettings" /> %d apps can read notifications - - Adaptive Notifications + + Enhanced notifications + + Get suggested actions, replies, and more None @@ -9051,10 +9053,11 @@ - %1$s will be able to read all notifications, - including personal information such as contact names and the text of messages you receive. - This app will also be able to dismiss notifications or take action on buttons in notifications, including answering phone calls. - \n\nThis will also give the app the ability to turn Do Not Disturb on or off and change related settings. + Enhanced notifications can read all notification content, + including personal information like contact names and messages. + This feature can also dismiss notifications or take actions on buttons in notifications, + such as answering phone calls. + \n\nThis feature can also turn Priority mode on or off and change related settings. + + diff --git a/res/xml/special_access.xml b/res/xml/special_access.xml index 83c23b5305a..892c3eb7455 100644 --- a/res/xml/special_access.xml +++ b/res/xml/special_access.xml @@ -80,13 +80,6 @@ android:value="com.android.settings.Settings$WriteSettingsActivity" /> - - Date: Mon, 12 Apr 2021 11:22:48 +0800 Subject: [PATCH 05/10] [Provider Model] Remove "Advanced" from Wi-Fi hotspot settings - Screenshot: https://screenshot.googleplex.com/B4vjvGdcQUL8YCR Bug: 184907962 Test: manual test make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherSettingsTest Change-Id: I934061c9129e77fc37381d1eba4a8107d40131eb --- .../android/settings/wifi/tether/WifiTetherSettings.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/com/android/settings/wifi/tether/WifiTetherSettings.java b/src/com/android/settings/wifi/tether/WifiTetherSettings.java index e34255035e5..088356b904e 100644 --- a/src/com/android/settings/wifi/tether/WifiTetherSettings.java +++ b/src/com/android/settings/wifi/tether/WifiTetherSettings.java @@ -294,13 +294,4 @@ public class WifiTetherSettings extends RestrictedDashboardFragment screen.setInitialExpandedChildrenCount(getInitialExpandedChildCount()); } } - - @Override - public int getInitialExpandedChildCount() { - if (mSecurityPreferenceController != null && mSecurityPreferenceController.getSecurityType() - == SoftApConfiguration.SECURITY_TYPE_OPEN) { - return (EXPANDED_CHILD_COUNT_DEFAULT - 1); - } - return EXPANDED_CHILD_COUNT_DEFAULT; - } } From 8371ee713de6b76906b191d3ff668d129437eded Mon Sep 17 00:00:00 2001 From: Jeremy Goldman Date: Tue, 23 Mar 2021 10:45:32 +0800 Subject: [PATCH 06/10] Update string for editing an insecure VPN. The new string comes from the connectivity s strings document: https://screenshot.googleplex.com/9nQFc9PFwgCYCFV Test: atest -c SettingsUnitTests Bug: 176821216 Bug: 184921649 Change-Id: I76257a4a2c2b9d5a49248296676d98980be9d77c Merged-In: I76257a4a2c2b9d5a49248296676d98980be9d77c (cherry picked from commit ec4b612932c4bbc50a492b851d2e46520436831b) --- res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 2688b320335..b045b553397 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -7221,7 +7221,7 @@ Require VPN connection? - This VPN is not secure. Update to an IKEv2 VPN + Not secure. Update to an IKEv2 VPN Select a VPN profile to always remain connected to. Network traffic will only be allowed when connected to this VPN. From 88ee31e269a8d4ba46e5e32496d89447178e137d Mon Sep 17 00:00:00 2001 From: Jeremy Goldman Date: Mon, 12 Apr 2021 15:37:19 +0800 Subject: [PATCH 07/10] Maintain VPN type form the VpnProfile the connectedLegacyVpn may already exist within the VpnProfiles. Because the stub profile generated from the LegacyVpnInfo does not contain type information, overriding whether the VPN is insecure using this information will provide an incomplete picture. Test: atest -c SettingsUnitTests Bug: 184922172 Change-Id: Icf2e08826c444863eaebdaa47bfd217795d2bad6 --- src/com/android/settings/vpn2/VpnSettings.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/vpn2/VpnSettings.java b/src/com/android/settings/vpn2/VpnSettings.java index cdc65372aed..181b78f535c 100644 --- a/src/com/android/settings/vpn2/VpnSettings.java +++ b/src/com/android/settings/vpn2/VpnSettings.java @@ -304,7 +304,9 @@ public class VpnSettings extends RestrictedSettingsFragment implements LegacyVpnPreference p = mSettings.findOrCreatePreference(stubProfile, false); p.setState(vpn.state); p.setAlwaysOn(lockdownVpnKey != null && lockdownVpnKey.equals(vpn.key)); - p.setInsecureVpn(VpnProfile.isLegacyType(stubProfile.type)); + // (b/184921649) do not call setInsecureVpn() for connectedLegacyVpns, since the + // LegacyVpnInfo does not contain VPN type information, and the profile already + // exists within vpnProfiles. updates.add(p); } From 304c68a836aa4859e71dbd1984531790bde65a13 Mon Sep 17 00:00:00 2001 From: Tsung-Mao Fang Date: Mon, 12 Apr 2021 16:28:03 +0800 Subject: [PATCH 08/10] Fix gender issue on subtext of screen pinning Create a new string id so that localization team can fix it individually. Test: Rebuilt rom and see correct subtext Fix: 184748174 Change-Id: I3ab644950ee8211c89199446b92e759a5efa4527 --- res/values/strings.xml | 5 +++++ .../settings/security/ScreenPinningPreferenceController.java | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 2688b320335..fefcd227baf 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -9769,6 +9769,11 @@ On Off + + + On + + Off App pinning diff --git a/src/com/android/settings/security/ScreenPinningPreferenceController.java b/src/com/android/settings/security/ScreenPinningPreferenceController.java index 37a3f9caaaf..442380d4925 100644 --- a/src/com/android/settings/security/ScreenPinningPreferenceController.java +++ b/src/com/android/settings/security/ScreenPinningPreferenceController.java @@ -40,7 +40,7 @@ public class ScreenPinningPreferenceController extends BasePreferenceController public CharSequence getSummary() { return Settings.System.getInt(mContext.getContentResolver(), Settings.System.LOCK_TO_APP_ENABLED, 0) != 0 - ? mContext.getText(R.string.switch_on_text) - : mContext.getText(R.string.switch_off_text); + ? mContext.getText(R.string.screen_pinning_switch_on_text) + : mContext.getText(R.string.screen_pinning_switch_off_text); } } From aa37e1dc4c4ea8576b32c5753d9d3fd5f4ab5826 Mon Sep 17 00:00:00 2001 From: Tsung-Mao Fang Date: Mon, 12 Apr 2021 16:17:53 +0800 Subject: [PATCH 09/10] Fix color lint error Test: repo upload is OK. Bug: 185091944 Change-Id: I52fa596dee5a17b8d29a771a18eced181a00ef6e --- color-check-baseline.xml | 446 +++++++++++++++++---------------------- 1 file changed, 199 insertions(+), 247 deletions(-) diff --git a/color-check-baseline.xml b/color-check-baseline.xml index 462f8289010..34aaf49aa83 100644 --- a/color-check-baseline.xml +++ b/color-check-baseline.xml @@ -2285,6 +2285,102 @@ column="23"/> + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + errorLine1=" <path android:fillColor="@color/homepage_generic_icon_background"" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + + + + + column="11"/> + errorLine1=" <path android:fillColor="@color/homepage_generic_icon_background"" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> - - - - + line="27" + column="11"/> - - - - + + + + + + + + + + + + + + + + @@ -3593,7 +3689,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~"> @@ -3609,7 +3705,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~"> @@ -3625,26 +3721,10 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~"> - - - - @@ -3689,7 +3769,7 @@ errorLine2=" ^"> @@ -3705,7 +3785,7 @@ errorLine2=" ^"> @@ -3721,7 +3801,7 @@ errorLine2=" ^"> @@ -3737,7 +3817,7 @@ errorLine2=" ^"> @@ -3753,7 +3833,7 @@ errorLine2=" ^"> @@ -3769,7 +3849,7 @@ errorLine2=" ^"> @@ -3785,7 +3865,7 @@ errorLine2=" ^"> @@ -3801,7 +3881,7 @@ errorLine2=" ^"> @@ -3817,7 +3897,7 @@ errorLine2=" ^"> @@ -3833,7 +3913,7 @@ errorLine2=" ^"> @@ -3849,7 +3929,7 @@ errorLine2=" ^"> @@ -4013,132 +4093,4 @@ column="5"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 01af86409dd3196426b0576679c3ab53e5ca5647 Mon Sep 17 00:00:00 2001 From: Jay Aliomer Date: Fri, 9 Apr 2021 14:27:10 -0400 Subject: [PATCH 10/10] Notif History Visual Buff Bug: b/184885964 Test: visual Change-Id: I390c01bd743ebed020cc8a1a05e8c70d4e9b4eb7 --- .../history/NotificationHistoryActivity.java | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/com/android/settings/notification/history/NotificationHistoryActivity.java b/src/com/android/settings/notification/history/NotificationHistoryActivity.java index 4958f1bfe6d..7fb4a48b195 100644 --- a/src/com/android/settings/notification/history/NotificationHistoryActivity.java +++ b/src/com/android/settings/notification/history/NotificationHistoryActivity.java @@ -83,6 +83,22 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { private PackageManager mPm; private CountDownLatch mCountdownLatch; private Future mCountdownFuture; + private final ViewOutlineProvider mOutlineProvider = new ViewOutlineProvider() { + @Override + public void getOutline(View view, Outline outline) { + final TypedArray ta = NotificationHistoryActivity.this.obtainStyledAttributes( + new int[]{android.R.attr.dialogCornerRadius}); + final float dialogCornerRadius = ta.getDimension(0, 0); + ta.recycle(); + TypedValue v = new TypedValue(); + NotificationHistoryActivity.this.getTheme().resolveAttribute( + com.android.internal.R.attr.listDivider, v, true); + int bottomPadding = NotificationHistoryActivity.this.getDrawable(v.resourceId) + .getIntrinsicHeight(); + outline.setRoundRect(0, 0, view.getWidth(), (view.getHeight() - bottomPadding), + dialogCornerRadius); + } + }; private UiEventLogger mUiEventLogger = new UiEventLoggerImpl(); enum NotificationHistoryEvent implements UiEventLogger.UiEventEnum { @@ -133,22 +149,7 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { notifications.isEmpty() ? View.GONE : View.VISIBLE); mCountdownLatch.countDown(); mTodayView.setClipToOutline(true); - mTodayView.setOutlineProvider(new ViewOutlineProvider() { - @Override - public void getOutline(View view, Outline outline) { - final TypedArray ta = NotificationHistoryActivity.this.obtainStyledAttributes( - new int[]{android.R.attr.dialogCornerRadius}); - final float dialogCornerRadius = ta.getDimension(0, 0); - ta.recycle(); - TypedValue v = new TypedValue(); - NotificationHistoryActivity.this.getTheme().resolveAttribute( - com.android.internal.R.attr.listDivider, v, true); - int bottomPadding = NotificationHistoryActivity.this.getDrawable(v.resourceId) - .getIntrinsicHeight(); - outline.setRoundRect(0, 0, view.getWidth(), (view.getHeight() - bottomPadding), - dialogCornerRadius); - } - }); + mTodayView.setOutlineProvider(mOutlineProvider); // for each package, new header and recycler view for (int i = 0, notificationsSize = notifications.size(); i < notificationsSize; i++) { NotificationHistoryPackage nhp = notifications.get(i); @@ -216,6 +217,8 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { mTodayView = findViewById(R.id.apps); mSnoozeView = findViewById(R.id.snoozed_list); mDismissView = findViewById(R.id.recently_dismissed_list); + mDismissView.setClipToOutline(true); + mDismissView.setOutlineProvider(mOutlineProvider); mHistoryOff = findViewById(R.id.history_off); mHistoryOn = findViewById(R.id.history_on); mHistoryEmpty = findViewById(R.id.history_on_empty);