Merge "Manage/History buttons should be multiuser aware" into rvc-dev am: 32c36ff2a5 am: c5593e8fee

Change-Id: I6be2b5e2fe429c55fdfda549d588e558f150d4e6
This commit is contained in:
Julia Reynolds
2020-05-05 23:08:08 +00:00
committed by Automerger Merge Worker
3 changed files with 9 additions and 6 deletions

View File

@@ -54,6 +54,7 @@ import android.graphics.Rect;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.provider.Settings;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
@@ -756,8 +757,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
boolean showFooterView = (showDismissView || hasActiveNotifications())
&& mStatusBarState != StatusBarState.KEYGUARD
&& !mRemoteInputManager.getController().isRemoteInputActive();
boolean showHistory = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.NOTIFICATION_HISTORY_ENABLED, 0) == 1;
boolean showHistory = Settings.Secure.getIntForUser(mContext.getContentResolver(),
Settings.Secure.NOTIFICATION_HISTORY_ENABLED, 0, UserHandle.USER_CURRENT) == 1;
updateFooterView(showFooterView, showDismissView, showHistory);
}
@@ -5730,8 +5731,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
R.layout.status_bar_no_notifications, this, false);
view.setText(R.string.empty_shade_text);
view.setOnClickListener(v -> {
final boolean showHistory = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.NOTIFICATION_HISTORY_ENABLED, 0) == 1;
final boolean showHistory = Settings.Secure.getIntForUser(mContext.getContentResolver(),
Settings.Secure.NOTIFICATION_HISTORY_ENABLED, 0, UserHandle.USER_CURRENT) == 1;
Intent intent = showHistory ? new Intent(
Settings.ACTION_NOTIFICATION_HISTORY) : new Intent(
Settings.ACTION_NOTIFICATION_SETTINGS);

View File

@@ -483,7 +483,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
if (showHistory) {
tsb.addNextIntent(intent);
}
tsb.startActivities();
tsb.startActivities(null, UserHandle.CURRENT);
if (shouldCollapse()) {
// Putting it back on the main thread, since we're touching views
mMainThreadHandler.post(() -> mCommandQueue.animateCollapsePanels(

View File

@@ -37,6 +37,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.metrics.LogMaker;
import android.os.UserHandle;
import android.provider.Settings;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
@@ -152,7 +153,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
NOTIFICATION_NEW_INTERRUPTION_MODEL, 0);
Settings.Secure.putInt(mContext.getContentResolver(),
NOTIFICATION_NEW_INTERRUPTION_MODEL, 1);
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_HISTORY_ENABLED, 1);
Settings.Secure.putIntForUser(mContext.getContentResolver(), NOTIFICATION_HISTORY_ENABLED,
1, UserHandle.USER_CURRENT);
// Inject dependencies before initializing the layout
mDependency.injectMockDependency(VisualStabilityManager.class);