Merge "Implement per-app sensitivity settings toggle." into lmp-dev

This commit is contained in:
Chris Wren
2014-09-04 13:40:04 +00:00
committed by Android (Google) Code Review
3 changed files with 32 additions and 6 deletions

View File

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