missing dep. Revert "Implement per-app sensitivity settings toggle."

This reverts commit 56131de741.

Change-Id: I409dbf4495f95ff37d2a47168cdbc4131a80d42e
This commit is contained in:
Chris Wren
2014-09-04 13:41:08 +00:00
committed by Dan Sandler
parent 77fdc93bcd
commit ee846f8828
3 changed files with 6 additions and 32 deletions

View File

@@ -39,6 +39,7 @@
android:key="sensitive" android:key="sensitive"
android:title="@string/app_notification_sensitive_title" android:title="@string/app_notification_sensitive_title"
android:summary="@string/app_notification_sensitive_summary" android:summary="@string/app_notification_sensitive_summary"
android:enabled="false"
android:persistent="false" /> android:persistent="false" />
</PreferenceScreen> </PreferenceScreen>

View File

@@ -137,9 +137,7 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
mSensitive = (SwitchPreference) findPreference(KEY_SENSITIVE); mSensitive = (SwitchPreference) findPreference(KEY_SENSITIVE);
final boolean secure = new LockPatternUtils(getActivity()).isSecure(); final boolean secure = new LockPatternUtils(getActivity()).isSecure();
final boolean enabled = getLockscreenNotificationsEnabled(); if (!secure) {
final boolean allowPrivate = getLockscreenAllowPrivateNotifications();
if (!secure || !enabled || !allowPrivate) {
getPreferenceScreen().removePreference(mSensitive); getPreferenceScreen().removePreference(mSensitive);
} }
@@ -195,16 +193,6 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
} }
} }
private boolean getLockscreenNotificationsEnabled() {
return Settings.Secure.getInt(getContentResolver(),
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0) != 0;
}
private boolean getLockscreenAllowPrivateNotifications() {
return Settings.Secure.getInt(getContentResolver(),
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0) != 0;
}
private void toastAndFinish() { private void toastAndFinish() {
Toast.makeText(mContext, R.string.app_not_found_dlg_text, Toast.LENGTH_SHORT).show(); Toast.makeText(mContext, R.string.app_not_found_dlg_text, Toast.LENGTH_SHORT).show();
getActivity().finish(); getActivity().finish();

View File

@@ -568,28 +568,13 @@ public class NotificationAppList extends PinnedHeaderListFragment
} }
public boolean getSensitive(String pkg, int uid) { public boolean getSensitive(String pkg, int uid) {
INotificationManager nm = INotificationManager.Stub.asInterface( // TODO get visibility state from NoMan
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
try {
return nm.getPackageVisibility(pkg, uid) == Notification.VISIBILITY_PRIVATE;
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
return false; return false;
} }
}
public boolean setSensitive(String pkg, int uid, boolean sensitive) { public boolean setSensitive(String pkg, int uid, boolean sensitive) {
INotificationManager nm = INotificationManager.Stub.asInterface( // TODO save visibility state to NoMan
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
try {
nm.setPackageVisibility(pkg, uid,
sensitive ? Notification.VISIBILITY_PRIVATE
: Notification.VISIBILITY_NO_OVERRIDE);
return true; return true;
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
return false;
}
} }
} }
} }