am cb877145: Merge "Zen: Remove "allow disable" filter from noman." into lmp-dev
* commit 'cb8771459629d1801cbecb1bad1754351e24f083': Zen: Remove "allow disable" filter from noman.
This commit is contained in:
@@ -16,8 +16,6 @@
|
||||
|
||||
package com.android.server.notification;
|
||||
|
||||
import android.os.IBinder;
|
||||
|
||||
public interface NotificationDelegate {
|
||||
void onSetDisabled(int status);
|
||||
void onClearAll(int callingUid, int callingPid, int userId);
|
||||
@@ -29,7 +27,6 @@ public interface NotificationDelegate {
|
||||
int uid, int initialPid, String message, int userId);
|
||||
void onPanelRevealed();
|
||||
void onPanelHidden();
|
||||
boolean allowDisable(int what, IBinder token, String pkg);
|
||||
void onNotificationVisibilityChanged(
|
||||
String[] newlyVisibleKeys, String[] noLongerVisibleKeys);
|
||||
void onNotificationExpansionChanged(String key, boolean userAction, boolean expanded);
|
||||
|
||||
@@ -29,7 +29,6 @@ import android.app.IActivityManager;
|
||||
import android.app.INotificationManager;
|
||||
import android.app.ITransientNotification;
|
||||
import android.app.Notification;
|
||||
import android.app.Notification.Builder;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.StatusBarManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -50,7 +49,6 @@ import android.media.AudioManager;
|
||||
import android.media.IRingtonePlayer;
|
||||
import android.net.Uri;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
@@ -584,11 +582,6 @@ public class NotificationManagerService extends SystemService {
|
||||
Binder.restoreCallingIdentity(ident);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowDisable(int what, IBinder token, String pkg) {
|
||||
return mZenModeHelper.allowDisable(what, token, pkg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotificationVisibilityChanged(
|
||||
String[] newlyVisibleKeys, String[] noLongerVisibleKeys) {
|
||||
|
||||
@@ -30,10 +30,7 @@ import android.util.Slog;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class ZenLog {
|
||||
private static final String TAG = "ZenLog";
|
||||
@@ -45,10 +42,6 @@ public class ZenLog {
|
||||
private static final String[] MSGS = new String[SIZE];
|
||||
|
||||
private static final SimpleDateFormat FORMAT = new SimpleDateFormat("MM-dd HH:mm:ss.SSS");
|
||||
private static final Set<String> SYSTEM_PACKAGES = new HashSet<String>(Arrays.asList(
|
||||
"android",
|
||||
"com.android.systemui"
|
||||
));
|
||||
|
||||
private static final int TYPE_INTERCEPTED = 1;
|
||||
private static final int TYPE_ALLOW_DISABLE = 2;
|
||||
@@ -76,11 +69,6 @@ public class ZenLog {
|
||||
append(TYPE_NOT_INTERCEPTED, record.getKey() + "," + reason);
|
||||
}
|
||||
|
||||
public static void traceAllowDisable(String pkg, boolean allowDisable, String reason) {
|
||||
if (SYSTEM_PACKAGES.contains(pkg)) return;
|
||||
append(TYPE_ALLOW_DISABLE, allowDisable + "," + pkg + "," + reason);
|
||||
}
|
||||
|
||||
public static void traceSetRingerMode(int ringerMode) {
|
||||
append(TYPE_SET_RINGER_MODE, ringerModeToString(ringerMode));
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import android.media.AudioAttributes;
|
||||
import android.media.AudioManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings.Global;
|
||||
import android.provider.Settings.Secure;
|
||||
@@ -265,18 +264,6 @@ public class ZenModeHelper {
|
||||
dispatchOnZenModeChanged();
|
||||
}
|
||||
|
||||
public boolean allowDisable(int what, IBinder token, String pkg) {
|
||||
// TODO(cwren): delete this API before the next release. Bug:15344099
|
||||
boolean allowDisable = true;
|
||||
String reason = null;
|
||||
if (isDefaultPhoneApp(pkg)) {
|
||||
allowDisable = mZenMode == Global.ZEN_MODE_OFF || mConfig.allowCalls;
|
||||
reason = mZenMode == Global.ZEN_MODE_OFF ? "zenOff" : "allowCalls";
|
||||
}
|
||||
ZenLog.traceAllowDisable(pkg, allowDisable, reason);
|
||||
return allowDisable;
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw, String prefix) {
|
||||
pw.print(prefix); pw.print("mZenMode=");
|
||||
pw.println(Global.zenModeToString(mZenMode));
|
||||
|
||||
@@ -22,7 +22,6 @@ import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.os.UserHandle;
|
||||
import android.service.notification.StatusBarNotification;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
@@ -39,9 +38,7 @@ import com.android.server.wm.WindowManagerService;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
@@ -187,10 +184,6 @@ public class StatusBarManagerService extends IStatusBarService.Stub {
|
||||
|
||||
@Override
|
||||
public void disable(int what, IBinder token, String pkg) {
|
||||
if (!mNotificationDelegate.allowDisable(what, token, pkg)) {
|
||||
if (SPEW) Slog.d(TAG, "Blocking disable request from " + pkg);
|
||||
return;
|
||||
}
|
||||
disableInternal(mCurrentUserId, what, token, pkg);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user