Merge "Add a setting to control whether clipboard access notifications are shown." into sc-dev
This commit is contained in:
@@ -9876,6 +9876,14 @@ public final class Settings {
|
||||
public static final String ASSIST_HANDLES_LEARNING_EVENT_COUNT =
|
||||
"reminder_exp_learning_event_count";
|
||||
|
||||
/**
|
||||
* Whether to show clipboard access notifications.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final String CLIPBOARD_SHOW_ACCESS_NOTIFICATIONS =
|
||||
"clipboard_show_access_notifications";
|
||||
|
||||
/**
|
||||
* These entries are considered common between the personal and the managed profile,
|
||||
* since the managed profile doesn't get to change them.
|
||||
|
||||
@@ -192,6 +192,12 @@ message SecureSettingsProto {
|
||||
optional Camera camera = 12;
|
||||
|
||||
optional SettingProto carrier_apps_handled = 13 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||
|
||||
message Clipboard {
|
||||
optional SettingProto show_access_notifications = 1 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||
}
|
||||
optional Clipboard clipboard = 89;
|
||||
|
||||
optional SettingProto cmas_additional_broadcast_pkg = 14 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||
repeated SettingProto completed_categories = 15;
|
||||
optional SettingProto connectivity_release_pending_intent_delay_ms = 16 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||
@@ -647,5 +653,5 @@ message SecureSettingsProto {
|
||||
|
||||
// Please insert fields in alphabetical order and group them into messages
|
||||
// if possible (to avoid reaching the method limit).
|
||||
// Next tag = 89;
|
||||
// Next tag = 90;
|
||||
}
|
||||
|
||||
@@ -281,5 +281,6 @@ public class SecureSettingsValidators {
|
||||
VALIDATORS.put(Secure.ACCESSIBILITY_FLOATING_MENU_OPACITY,
|
||||
new InclusiveFloatRangeValidator(0.0f, 1.0f));
|
||||
VALIDATORS.put(Secure.ACCESSIBILITY_FLOATING_MENU_FADE_ENABLED, BOOLEAN_VALIDATOR);
|
||||
VALIDATORS.put(Secure.CLIPBOARD_SHOW_ACCESS_NOTIFICATIONS, BOOLEAN_VALIDATOR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1990,6 +1990,13 @@ class SettingsProtoDumpUtil {
|
||||
dumpSetting(s, p,
|
||||
Settings.Secure.CARRIER_APPS_HANDLED,
|
||||
SecureSettingsProto.CARRIER_APPS_HANDLED);
|
||||
|
||||
final long clipboardToken = p.start(SecureSettingsProto.CLIPBOARD);
|
||||
dumpSetting(s, p,
|
||||
Settings.Secure.CLIPBOARD_SHOW_ACCESS_NOTIFICATIONS,
|
||||
SecureSettingsProto.Clipboard.SHOW_ACCESS_NOTIFICATIONS);
|
||||
p.end(clipboardToken);
|
||||
|
||||
dumpSetting(s, p,
|
||||
Settings.Secure.CMAS_ADDITIONAL_BROADCAST_PKG,
|
||||
SecureSettingsProto.CMAS_ADDITIONAL_BROADCAST_PKG);
|
||||
|
||||
@@ -922,6 +922,10 @@ public class ClipboardService extends SystemService {
|
||||
if (!mShowAccessNotifications) {
|
||||
return;
|
||||
}
|
||||
if (Settings.Secure.getInt(getContext().getContentResolver(),
|
||||
Settings.Secure.CLIPBOARD_SHOW_ACCESS_NOTIFICATIONS, 1) == 0) {
|
||||
return;
|
||||
}
|
||||
// Don't notify if the app accessing the clipboard is the same as the current owner.
|
||||
if (UserHandle.isSameApp(uid, clipboard.primaryClipUid)) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user