Loading src/com/android/settings/accounts/AccountTypePreferenceLoader.java +8 −1 Original line number Diff line number Diff line Loading @@ -269,7 +269,14 @@ public class AccountTypePreferenceLoader { try { // Allows to launch only authenticator owned activities. ApplicationInfo authenticatorAppInf = pm.getApplicationInfo(authDesc.packageName, 0); return resolvedAppInfo.uid == authenticatorAppInf.uid; if (resolvedAppInfo.uid == authenticatorAppInf.uid) { // Explicitly set the component to be same as authenticator to // prevent launching arbitrary activities. intent.setComponent(resolvedActivityInfo.getComponentName()); return true; } else { return false; } } catch (NameNotFoundException e) { Log.e(TAG, "Intent considered unsafe due to exception.", Loading src/com/android/settings/biometrics/BiometricEnrollIntroduction.java +14 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ import com.google.android.setupdesign.span.LinkSpan; import com.google.android.setupdesign.template.RequireScrollMixin; import com.google.android.setupdesign.util.DynamicColorPalette; import java.util.List; /** * Abstract base class for the intro onboarding activity for biometric enrollment. */ Loading Loading @@ -220,6 +222,18 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase }); } @Override protected void onStart() { super.onStart(); if (!getPackageName().equals(getCallingPackage())) { for (String key : List.of(MultiBiometricEnrollHelper.EXTRA_SKIP_PENDING_ENROLL, MultiBiometricEnrollHelper.EXTRA_ENROLL_AFTER_FACE)) { getIntent().removeExtra(key); } } } @Override protected void onResume() { super.onResume(); Loading src/com/android/settings/biometrics/face/FaceSettings.java +14 −5 Original line number Diff line number Diff line Loading @@ -67,8 +67,8 @@ public class FaceSettings extends DashboardFragment { private UserManager mUserManager; private FaceManager mFaceManager; private int mUserId; private int mSensorId; private long mChallenge; private int mSensorId = -1; private long mChallenge = 0; private byte[] mToken; private FaceSettingsAttentionPreferenceController mAttentionController; private FaceSettingsRemoveButtonPreferenceController mRemoveController; Loading Loading @@ -148,9 +148,18 @@ public class FaceSettings extends DashboardFragment { mUserManager = context.getSystemService(UserManager.class); mFaceManager = context.getSystemService(FaceManager.class); final SettingsActivity activity = (SettingsActivity) requireActivity(); final String callingPackage = activity.getInitialCallingPackage(); if (callingPackage == null || !callingPackage.equals(activity.getPackageName())) { mUserId = UserHandle.myUserId(); } else { // only allow these extras when called internally by Settings mToken = getIntent().getByteArrayExtra(KEY_TOKEN); mSensorId = getIntent().getIntExtra(BiometricEnrollBase.EXTRA_KEY_SENSOR_ID, -1); mChallenge = getIntent().getLongExtra(BiometricEnrollBase.EXTRA_KEY_CHALLENGE, 0L); mUserId = getIntent().getIntExtra(Intent.EXTRA_USER_ID, UserHandle.myUserId()); } mUserId = getActivity().getIntent().getIntExtra( Intent.EXTRA_USER_ID, UserHandle.myUserId()); Loading src/com/android/settings/notification/history/NotificationHistoryActivity.java +28 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.settings.notification.history; import static android.provider.Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS; import static android.provider.Settings.Secure.NOTIFICATION_HISTORY_ENABLED; import static androidx.core.view.accessibility.AccessibilityEventCompat.TYPE_VIEW_ACCESSIBILITY_FOCUSED; Loading @@ -25,9 +26,11 @@ import android.annotation.ColorInt; import android.app.ActionBar; import android.app.ActivityManager; import android.app.INotificationManager; import android.app.KeyguardManager; import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageManager; import android.content.pm.UserInfo; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Outline; Loading Loading @@ -56,6 +59,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.android.internal.logging.UiEvent; import com.android.internal.logging.UiEventLogger; import com.android.internal.logging.UiEventLoggerImpl; import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.NotificationExpandButton; import com.android.settings.R; import com.android.settings.notification.NotificationBackend; Loading @@ -66,6 +70,7 @@ import com.android.settingslib.widget.OnMainSwitchChangeListener; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; Loading Loading @@ -106,6 +111,9 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { }; private UiEventLogger mUiEventLogger = new UiEventLoggerImpl(); // List of users that have the setting "hide sensitive content" enabled on the lockscreen private ArrayList<Integer> mContentRestrictedUsers = new ArrayList<>(); enum NotificationHistoryEvent implements UiEventLogger.UiEventEnum { @UiEvent(doc = "User turned on notification history") NOTIFICATION_HISTORY_ON(504), Loading Loading @@ -204,7 +212,7 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { final NotificationHistoryRecyclerView rv = viewForPackage.findViewById(R.id.notification_list); rv.setAdapter(new NotificationHistoryAdapter(mNm, rv, rv.setAdapter(new NotificationHistoryAdapter(NotificationHistoryActivity.this, mNm, rv, newCount -> { count.setText(getResources().getQuantityString( R.plurals.notification_history_count, Loading @@ -212,7 +220,7 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { if (newCount == 0) { viewForPackage.setVisibility(View.GONE); } }, mUiEventLogger)); }, mUiEventLogger, mContentRestrictedUsers)); ((NotificationHistoryAdapter) rv.getAdapter()).onRebuildComplete( new ArrayList<>(nhp.notifications)); Loading Loading @@ -254,6 +262,21 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { mPm = getPackageManager(); mUm = getSystemService(UserManager.class); mContentRestrictedUsers.clear(); List<UserInfo> users = mUm.getProfiles(getUserId()); mContentRestrictedUsers.clear(); for (UserInfo user : users) { if (Settings.Secure.getIntForUser(getContentResolver(), LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0, user.id) == 0) { LockPatternUtils lpu = new LockPatternUtils(this); KeyguardManager km = getSystemService(KeyguardManager.class); if (lpu.isSecure(user.id) && km.isDeviceLocked(user.id)) { mContentRestrictedUsers.add(user.id); } } } // wait for history loading and recent/snooze loading mCountdownLatch = new CountDownLatch(2); Loading Loading @@ -308,6 +331,7 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { if (mCountdownFuture != null) { mCountdownFuture.cancel(true); } mContentRestrictedUsers.clear(); super.onDestroy(); } Loading Loading @@ -396,7 +420,7 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { mSnoozedRv.setLayoutManager(lm); mSnoozedRv.setAdapter( new NotificationSbnAdapter(NotificationHistoryActivity.this, mPm, mUm, true, mUiEventLogger)); true, mUiEventLogger, mContentRestrictedUsers)); mSnoozedRv.setNestedScrollingEnabled(false); if (snoozed == null || snoozed.length == 0) { Loading @@ -412,7 +436,7 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { mDismissedRv.setLayoutManager(dismissLm); mDismissedRv.setAdapter( new NotificationSbnAdapter(NotificationHistoryActivity.this, mPm, mUm, false, mUiEventLogger)); false, mUiEventLogger, mContentRestrictedUsers)); mDismissedRv.setNestedScrollingEnabled(false); if (dismissed == null || dismissed.length == 0) { Loading src/com/android/settings/notification/history/NotificationHistoryAdapter.java +18 −4 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.provider.Settings.EXTRA_CONVERSATION_ID; import android.app.INotificationManager; import android.app.NotificationHistory.HistoricalNotification; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.RemoteException; Loading Loading @@ -52,16 +53,23 @@ public class NotificationHistoryAdapter extends private List<HistoricalNotification> mValues; private OnItemDeletedListener mListener; private UiEventLogger mUiEventLogger; public NotificationHistoryAdapter(INotificationManager nm, private ArrayList<Integer> mContentRestrictedUsers = new ArrayList<>(); Context mContext; public NotificationHistoryAdapter(Context context, INotificationManager nm, NotificationHistoryRecyclerView listView, OnItemDeletedListener listener, UiEventLogger uiEventLogger) { UiEventLogger uiEventLogger, ArrayList<Integer> contentRestrictedUsers) { mContext = context; mValues = new ArrayList<>(); setHasStableIds(true); listView.setOnItemSwipeDeleteListener(this); mNm = nm; mListener = listener; mUiEventLogger = uiEventLogger; mContentRestrictedUsers = contentRestrictedUsers; } @Override Loading @@ -80,8 +88,14 @@ public class NotificationHistoryAdapter extends public void onBindViewHolder(final @NonNull NotificationHistoryViewHolder holder, int position) { final HistoricalNotification hn = mValues.get(position); // Redact sensitive notification content if needed if (mContentRestrictedUsers.contains(hn.getUserId())) { holder.setSummary(mContext.getString( com.android.internal.R.string.notification_hidden_text)); } else { holder.setTitle(hn.getTitle()); holder.setSummary(hn.getText()); } holder.setPostedTime(hn.getPostedTimeMs()); final View.OnClickListener onClick = v -> { mUiEventLogger.logWithPosition(NotificationHistoryActivity.NotificationHistoryEvent Loading Loading
src/com/android/settings/accounts/AccountTypePreferenceLoader.java +8 −1 Original line number Diff line number Diff line Loading @@ -269,7 +269,14 @@ public class AccountTypePreferenceLoader { try { // Allows to launch only authenticator owned activities. ApplicationInfo authenticatorAppInf = pm.getApplicationInfo(authDesc.packageName, 0); return resolvedAppInfo.uid == authenticatorAppInf.uid; if (resolvedAppInfo.uid == authenticatorAppInf.uid) { // Explicitly set the component to be same as authenticator to // prevent launching arbitrary activities. intent.setComponent(resolvedActivityInfo.getComponentName()); return true; } else { return false; } } catch (NameNotFoundException e) { Log.e(TAG, "Intent considered unsafe due to exception.", Loading
src/com/android/settings/biometrics/BiometricEnrollIntroduction.java +14 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ import com.google.android.setupdesign.span.LinkSpan; import com.google.android.setupdesign.template.RequireScrollMixin; import com.google.android.setupdesign.util.DynamicColorPalette; import java.util.List; /** * Abstract base class for the intro onboarding activity for biometric enrollment. */ Loading Loading @@ -220,6 +222,18 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase }); } @Override protected void onStart() { super.onStart(); if (!getPackageName().equals(getCallingPackage())) { for (String key : List.of(MultiBiometricEnrollHelper.EXTRA_SKIP_PENDING_ENROLL, MultiBiometricEnrollHelper.EXTRA_ENROLL_AFTER_FACE)) { getIntent().removeExtra(key); } } } @Override protected void onResume() { super.onResume(); Loading
src/com/android/settings/biometrics/face/FaceSettings.java +14 −5 Original line number Diff line number Diff line Loading @@ -67,8 +67,8 @@ public class FaceSettings extends DashboardFragment { private UserManager mUserManager; private FaceManager mFaceManager; private int mUserId; private int mSensorId; private long mChallenge; private int mSensorId = -1; private long mChallenge = 0; private byte[] mToken; private FaceSettingsAttentionPreferenceController mAttentionController; private FaceSettingsRemoveButtonPreferenceController mRemoveController; Loading Loading @@ -148,9 +148,18 @@ public class FaceSettings extends DashboardFragment { mUserManager = context.getSystemService(UserManager.class); mFaceManager = context.getSystemService(FaceManager.class); final SettingsActivity activity = (SettingsActivity) requireActivity(); final String callingPackage = activity.getInitialCallingPackage(); if (callingPackage == null || !callingPackage.equals(activity.getPackageName())) { mUserId = UserHandle.myUserId(); } else { // only allow these extras when called internally by Settings mToken = getIntent().getByteArrayExtra(KEY_TOKEN); mSensorId = getIntent().getIntExtra(BiometricEnrollBase.EXTRA_KEY_SENSOR_ID, -1); mChallenge = getIntent().getLongExtra(BiometricEnrollBase.EXTRA_KEY_CHALLENGE, 0L); mUserId = getIntent().getIntExtra(Intent.EXTRA_USER_ID, UserHandle.myUserId()); } mUserId = getActivity().getIntent().getIntExtra( Intent.EXTRA_USER_ID, UserHandle.myUserId()); Loading
src/com/android/settings/notification/history/NotificationHistoryActivity.java +28 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.settings.notification.history; import static android.provider.Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS; import static android.provider.Settings.Secure.NOTIFICATION_HISTORY_ENABLED; import static androidx.core.view.accessibility.AccessibilityEventCompat.TYPE_VIEW_ACCESSIBILITY_FOCUSED; Loading @@ -25,9 +26,11 @@ import android.annotation.ColorInt; import android.app.ActionBar; import android.app.ActivityManager; import android.app.INotificationManager; import android.app.KeyguardManager; import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageManager; import android.content.pm.UserInfo; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Outline; Loading Loading @@ -56,6 +59,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.android.internal.logging.UiEvent; import com.android.internal.logging.UiEventLogger; import com.android.internal.logging.UiEventLoggerImpl; import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.NotificationExpandButton; import com.android.settings.R; import com.android.settings.notification.NotificationBackend; Loading @@ -66,6 +70,7 @@ import com.android.settingslib.widget.OnMainSwitchChangeListener; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; Loading Loading @@ -106,6 +111,9 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { }; private UiEventLogger mUiEventLogger = new UiEventLoggerImpl(); // List of users that have the setting "hide sensitive content" enabled on the lockscreen private ArrayList<Integer> mContentRestrictedUsers = new ArrayList<>(); enum NotificationHistoryEvent implements UiEventLogger.UiEventEnum { @UiEvent(doc = "User turned on notification history") NOTIFICATION_HISTORY_ON(504), Loading Loading @@ -204,7 +212,7 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { final NotificationHistoryRecyclerView rv = viewForPackage.findViewById(R.id.notification_list); rv.setAdapter(new NotificationHistoryAdapter(mNm, rv, rv.setAdapter(new NotificationHistoryAdapter(NotificationHistoryActivity.this, mNm, rv, newCount -> { count.setText(getResources().getQuantityString( R.plurals.notification_history_count, Loading @@ -212,7 +220,7 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { if (newCount == 0) { viewForPackage.setVisibility(View.GONE); } }, mUiEventLogger)); }, mUiEventLogger, mContentRestrictedUsers)); ((NotificationHistoryAdapter) rv.getAdapter()).onRebuildComplete( new ArrayList<>(nhp.notifications)); Loading Loading @@ -254,6 +262,21 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { mPm = getPackageManager(); mUm = getSystemService(UserManager.class); mContentRestrictedUsers.clear(); List<UserInfo> users = mUm.getProfiles(getUserId()); mContentRestrictedUsers.clear(); for (UserInfo user : users) { if (Settings.Secure.getIntForUser(getContentResolver(), LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0, user.id) == 0) { LockPatternUtils lpu = new LockPatternUtils(this); KeyguardManager km = getSystemService(KeyguardManager.class); if (lpu.isSecure(user.id) && km.isDeviceLocked(user.id)) { mContentRestrictedUsers.add(user.id); } } } // wait for history loading and recent/snooze loading mCountdownLatch = new CountDownLatch(2); Loading Loading @@ -308,6 +331,7 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { if (mCountdownFuture != null) { mCountdownFuture.cancel(true); } mContentRestrictedUsers.clear(); super.onDestroy(); } Loading Loading @@ -396,7 +420,7 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { mSnoozedRv.setLayoutManager(lm); mSnoozedRv.setAdapter( new NotificationSbnAdapter(NotificationHistoryActivity.this, mPm, mUm, true, mUiEventLogger)); true, mUiEventLogger, mContentRestrictedUsers)); mSnoozedRv.setNestedScrollingEnabled(false); if (snoozed == null || snoozed.length == 0) { Loading @@ -412,7 +436,7 @@ public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity { mDismissedRv.setLayoutManager(dismissLm); mDismissedRv.setAdapter( new NotificationSbnAdapter(NotificationHistoryActivity.this, mPm, mUm, false, mUiEventLogger)); false, mUiEventLogger, mContentRestrictedUsers)); mDismissedRv.setNestedScrollingEnabled(false); if (dismissed == null || dismissed.length == 0) { Loading
src/com/android/settings/notification/history/NotificationHistoryAdapter.java +18 −4 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.provider.Settings.EXTRA_CONVERSATION_ID; import android.app.INotificationManager; import android.app.NotificationHistory.HistoricalNotification; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.RemoteException; Loading Loading @@ -52,16 +53,23 @@ public class NotificationHistoryAdapter extends private List<HistoricalNotification> mValues; private OnItemDeletedListener mListener; private UiEventLogger mUiEventLogger; public NotificationHistoryAdapter(INotificationManager nm, private ArrayList<Integer> mContentRestrictedUsers = new ArrayList<>(); Context mContext; public NotificationHistoryAdapter(Context context, INotificationManager nm, NotificationHistoryRecyclerView listView, OnItemDeletedListener listener, UiEventLogger uiEventLogger) { UiEventLogger uiEventLogger, ArrayList<Integer> contentRestrictedUsers) { mContext = context; mValues = new ArrayList<>(); setHasStableIds(true); listView.setOnItemSwipeDeleteListener(this); mNm = nm; mListener = listener; mUiEventLogger = uiEventLogger; mContentRestrictedUsers = contentRestrictedUsers; } @Override Loading @@ -80,8 +88,14 @@ public class NotificationHistoryAdapter extends public void onBindViewHolder(final @NonNull NotificationHistoryViewHolder holder, int position) { final HistoricalNotification hn = mValues.get(position); // Redact sensitive notification content if needed if (mContentRestrictedUsers.contains(hn.getUserId())) { holder.setSummary(mContext.getString( com.android.internal.R.string.notification_hidden_text)); } else { holder.setTitle(hn.getTitle()); holder.setSummary(hn.getText()); } holder.setPostedTime(hn.getPostedTimeMs()); final View.OnClickListener onClick = v -> { mUiEventLogger.logWithPosition(NotificationHistoryActivity.NotificationHistoryEvent Loading