Skip to content

Instantly share code, notes, and snippets.

@mbrownnycnyc
Last active April 13, 2023 13:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbrownnycnyc/5b774478ad5a6de7474f89f0811afa69 to your computer and use it in GitHub Desktop.
Save mbrownnycnyc/5b774478ad5a6de7474f89f0811afa69 to your computer and use it in GitHub Desktop.
Disabling heads up notifications on android per app. Requires root access. This will simply hide: "sim card is not from verizon wireless"
#you can do the below if you have root.
# if you don't have root, you can uninstall the Samsung Setup Wizard. Not sure if this is at all valuable, as you can configure APNs manually worst case. Best case, it has no affect on OTA activations (which I truly don't think it does):
# adb shell
# pm uninstall -k --user 0 com.sec.android.app.setupwizard
# cycle airplane mode and you'll see you don't get the notification.
"sim card is not from verizon wireless"
Procedure requires root access, so that the /data/system/notification_policy.xml file can be modified.
Option 1: Disable notification per app:
1) plugin device to USB
2) acknowledge usb debugging on android screen.
3) verify it is connected to adb:
adb devices
3) connect to adb shell from PC:
adb shell
4) verify the notification service is present:
service list | grep notification
service check notification
5) obtain the android version:
getprop ro.build.version.release
6) obtain the android SDK version:
getprop ro.build.version.sdk
7) locate the code for notifications.aidl (since we know "android.app.INotificationManager")
https://android.googlesource.com/platform/frameworks/base/+/android-8.0.0_r26/core/java/android/app/INotificationManager.aidl
8) locate the number in-sequence for the setNotificationsEnabledForPackage function [count starts at 1 not 0]
1 void cancelAllNotifications(String pkg, int userId);
2 void clearData(String pkg, int uid, boolean fromApp);
3 void enqueueToast(String pkg, ITransientNotification callback, int duration);
4 void cancelToast(String pkg, ITransientNotification callback);
5 void enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id, in Notification notification, int userId);
6 void cancelNotificationWithTag(String pkg, String tag, int id, int userId);
7 void setShowBadge(String pkg, int uid, boolean showBadge);
8 boolean canShowBadge(String pkg, int uid);
9 void setNotificationsEnabledForPackage(String pkg, int uid, boolean enabled);
9) verify that you have access to the file (requires root)
ls -al /data/system/notification_policy.xml
10) change the setting building the line: s16 = string, i32 = 32-bit integer, you can use an 32-bit integer for booleans:
service call notification 9 s16 \"com.sec.android.app.setupwizard\" i32 uid i32 0
11) Not root?
Result: Parcel(
0x00000000: ffffffff 0000001c 00690044 00610073 '........D.i.s.a.'
0x00000010: 006c006c 0077006f 00640065 00630020 'l.l.o.w.e.d. .c.'
0x00000020: 006c0061 0020006c 006f0066 00200072 'a.l.l. .f.o.r. .'
0x00000030: 00690075 00200064 00300032 00300030 'u.i.d. .2.0.0.0.'
0x00000040: 00000000 '.... ')
Option 2: Disable app:
1) uninstall via `adb shell`
pm disable com.sec.android.app.setupwizard
2) Not root?
Error: java.lang.SecurityException: Shell cannot change component state for com.sec.android.app.setupwizard/null to 2
Option 3: uninstall app:
1) uninstall via `adb shell`
pm disable com.sec.android.app.setupwizard
2) not root?
Error: java.lang.SecurityException: Shell cannot change component state for com.sec.android.app.setupwizard/null to 2
Notes:
adb name spaces are:
namespaces: global, system, secure
settings get global
"sim card is not from verizon wireless"
com.sec.android.app.setupwizard/
com.sec.android.ap.setupwizard.vzw.activation.InitActivity
For all heads up notifications:
settings get global heads_up_notifications_enabled 0
`1` Ringer mode: Ring/normal – default ringtone, strong vibration strength, heads up on, ambient screen on, led light on
`2` Ringer mode: Do not disturb/priority – same but ringtone changed to silent, heads up off
`3` Ringer mode: Silent – ringtone set to silent, 50% vibration strength, heads up off, ambient screen off, led lights off
#https://stackoverflow.com/questions/38631990/disable-heads-up-notification-for-a-specific-app-using-adb
#https://stackoverflow.com/questions/20227326/where-to-find-info-on-androids-service-call-shell-command
# service call notification 6 s16 \"com.sec.android.app.setupwizard\" i32 uid i32 0/1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment