Merge "Inline Controls hide Settings button when no appropriate link." into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
18cbccbfb0
@@ -228,6 +228,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G
|
||||
// Settings button.
|
||||
final TextView settingsButton = (TextView) findViewById(R.id.more_settings);
|
||||
if (mAppUid >= 0 && onSettingsClick != null) {
|
||||
settingsButton.setVisibility(View.VISIBLE);
|
||||
final int appUidF = mAppUid;
|
||||
settingsButton.setOnClickListener(
|
||||
(View view) -> {
|
||||
|
||||
@@ -5769,12 +5769,16 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
|
||||
final String pkg = sbn.getPackageName();
|
||||
NotificationInfo info = (NotificationInfo) gutsView;
|
||||
final NotificationInfo.OnSettingsClickListener onSettingsClick = (View v,
|
||||
NotificationChannel channel, int appUid) -> {
|
||||
mMetricsLogger.action(MetricsEvent.ACTION_NOTE_INFO);
|
||||
guts.resetFalsingCheck();
|
||||
startAppNotificationSettingsActivity(pkg, appUid, channel);
|
||||
};
|
||||
// Settings link is only valid for notifications that specify a user, unless this is the
|
||||
// system user.
|
||||
NotificationInfo.OnSettingsClickListener onSettingsClick = null;
|
||||
if (!userHandle.equals(UserHandle.ALL) || mCurrentUserId == UserHandle.USER_SYSTEM) {
|
||||
onSettingsClick = (View v, NotificationChannel channel, int appUid) -> {
|
||||
mMetricsLogger.action(MetricsEvent.ACTION_NOTE_INFO);
|
||||
guts.resetFalsingCheck();
|
||||
startAppNotificationSettingsActivity(pkg, appUid, channel);
|
||||
};
|
||||
}
|
||||
final View.OnClickListener onDoneClick = (View v) -> {
|
||||
saveAndCloseNotificationMenu(info, row, guts, v);
|
||||
};
|
||||
|
||||
@@ -205,6 +205,29 @@ public class NotificationInfoTest extends SysuiTestCase {
|
||||
assertEquals(0, latch.getCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBindNotification_SettingsButtonInvisibleWhenNoClickListener() throws Exception {
|
||||
mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
|
||||
TEST_PACKAGE_NAME, Arrays.asList(mNotificationChannel),
|
||||
null, null, null, null);
|
||||
final TextView settingsButton =
|
||||
(TextView) mNotificationInfo.findViewById(R.id.more_settings);
|
||||
assertTrue(settingsButton.getVisibility() != View.VISIBLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBindNotification_SettingsButtonReappersAfterSecondBind() throws Exception {
|
||||
mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
|
||||
TEST_PACKAGE_NAME, Arrays.asList(mNotificationChannel),
|
||||
null, null, null, null);
|
||||
mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
|
||||
TEST_PACKAGE_NAME, Arrays.asList(mNotificationChannel),
|
||||
(View v, NotificationChannel c, int appUid) -> {}, null, null, null);
|
||||
final TextView settingsButton =
|
||||
(TextView) mNotificationInfo.findViewById(R.id.more_settings);
|
||||
assertEquals(View.VISIBLE, settingsButton.getVisibility());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnClickListenerPassesNullChannelForBundle() throws Exception {
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
Reference in New Issue
Block a user