33import android .annotation .SuppressLint ;
44import android .app .Notification ;
55import android .content .Context ;
6- import android .content .Intent ;
76import android .content .SharedPreferences ;
87import android .content .pm .PackageManager ;
9- import android .content .pm .ResolveInfo ;
108import android .graphics .Bitmap ;
119import android .graphics .Canvas ;
1210import android .graphics .Matrix ;
@@ -210,13 +208,7 @@ private void QueryGC() {
210208 }
211209
212210 private String getSystemDialerApp (Context context ) {
213- if (Build .VERSION .SDK_INT > 22 ) {
214- return ((TelecomManager ) context .getSystemService (Context .TELECOM_SERVICE )).getDefaultDialerPackage ();
215- } else {
216- Intent dialerIntent = new Intent (Intent .ACTION_DIAL ).addCategory (Intent .CATEGORY_DEFAULT );
217- List <ResolveInfo > mResolveInfoList = context .getPackageManager ().queryIntentActivities (dialerIntent , 0 );
218- return mResolveInfoList .get (0 ).activityInfo .packageName ;
219- }
211+ return ((TelecomManager ) context .getSystemService (Context .TELECOM_SERVICE )).getDefaultDialerPackage ();
220212 }
221213
222214 private boolean isTelephonyApp (Context context , String packageName ) {
@@ -229,6 +221,11 @@ private boolean isTelephonyApp(Context context, String packageName) {
229221 }
230222 }
231223
224+ @ Override
225+ public void onNotificationRemoved (StatusBarNotification sbn ) {
226+ super .onNotificationRemoved (sbn );
227+ }
228+
232229 @ Override
233230 public void onNotificationPosted (StatusBarNotification sbn ) {
234231 super .onNotificationPosted (sbn );
@@ -251,7 +248,7 @@ public void onNotificationPosted(StatusBarNotification sbn) {
251248
252249 boolean isLogging = BuildConfig .DEBUG ;
253250
254- if (!prefs .getString ("UID" , "" ).equals ( "" ) && prefs .getBoolean ("serviceToggle" , false )) {
251+ if (!prefs .getString ("UID" , "" ).isEmpty ( ) && prefs .getBoolean ("serviceToggle" , false )) {
255252 String mode = prefs .getString ("service" , "reception" );
256253 if (mode .equals ("send" ) || mode .equals ("hybrid" )) {
257254 String TITLE = getNonNullString (extra .getString (Notification .EXTRA_TITLE ));
@@ -290,7 +287,7 @@ public void onNotificationPosted(StatusBarNotification sbn) {
290287 JSONObject object = new JSONObject ();
291288 String originString = logPrefs .getString ("sendLogs" , "" );
292289
293- if (!originString .equals ( "" )) array = new JSONArray (originString );
290+ if (!originString .isEmpty ( )) array = new JSONArray (originString );
294291 object .put ("date" , DATE );
295292 object .put ("package" , PackageName );
296293 object .put ("title" , extra .getString (Notification .EXTRA_TITLE ));
@@ -382,25 +379,15 @@ private void sendNormalNotification(Notification notification, String PackageNam
382379 try {
383380 if (prefs .getBoolean ("IconUseNotification" , false )) {
384381 Context packageContext = createPackageContext (PackageName , CONTEXT_IGNORE_SECURITY );
385-
386- if (Build .VERSION .SDK_INT > 22 ) {
387- Icon LargeIcon = notification .getLargeIcon ();
388- Icon SmallIcon = notification .getSmallIcon ();
389-
390- if (LargeIcon != null )
391- ICON = getBitmapFromDrawable (LargeIcon .loadDrawable (packageContext ));
392- else if (SmallIcon != null )
393- ICON = getBitmapFromDrawable (SmallIcon .loadDrawable (packageContext ));
394- else
395- ICON = getBitmapFromDrawable (pm .getApplicationIcon (PackageName ));
396- } else {
397- Bitmap LargeIcon = notification .largeIcon ;
398- int SmallIcon = notification .icon ;
399-
400- if (LargeIcon != null ) ICON = LargeIcon ;
401- else if (SmallIcon != 0 )
402- ICON = getBitmapFromDrawable (packageContext .getDrawable (SmallIcon ));
403- }
382+ Icon LargeIcon = notification .getLargeIcon ();
383+ Icon SmallIcon = notification .getSmallIcon ();
384+
385+ if (LargeIcon != null )
386+ ICON = getBitmapFromDrawable (LargeIcon .loadDrawable (packageContext ));
387+ else if (SmallIcon != null )
388+ ICON = getBitmapFromDrawable (SmallIcon .loadDrawable (packageContext ));
389+ else
390+ ICON = getBitmapFromDrawable (pm .getApplicationIcon (PackageName ));
404391 } else {
405392 ICON = getBitmapFromDrawable (pm .getApplicationIcon (PackageName ));
406393 }
@@ -459,7 +446,7 @@ else if (SmallIcon != 0)
459446 private boolean isBannedWords (String TEXT , String TITLE ) {
460447 if (prefs .getBoolean ("UseBannedOption" , false )) {
461448 String word = prefs .getString ("BannedWords" , "" );
462- if (!word .equals ( "" )) {
449+ if (!word .isEmpty ( )) {
463450 String [] words = word .split ("/" );
464451 for (String s : words ) {
465452 if ((TEXT != null && TEXT .contains (s )) || (TITLE != null && TITLE .contains (s )))
@@ -668,7 +655,7 @@ protected static JSONObject encryptData(JSONObject data) throws Exception {
668655 String DEVICE_ID = getUniqueID ();
669656 String HmacToken = HMACCrypto .generateTokenIdentifier (DEVICE_NAME , DEVICE_ID );
670657
671- if ((useEncryption && !rawPassword .equals ( "" )) || isAlwaysEncryptData ) {
658+ if ((useEncryption && !rawPassword .isEmpty ( )) || isAlwaysEncryptData ) {
672659 String uid = FirebaseAuth .getInstance ().getUid ();
673660 if (uid != null ) {
674661 String finalPassword = AESCrypto .parseAESToken (useEncryption ? AESCrypto .decrypt (rawPassword , AESCrypto .parseAESToken (uid )) : Base64 .encodeToString (prefs .getString ("Email" , "" ).getBytes (StandardCharsets .UTF_8 ), Base64 .NO_WRAP ));
@@ -716,7 +703,7 @@ protected static void finalProcessData(JSONObject notification, String PackageNa
716703 case "Firebase Cloud Message" ->
717704 sendFCMNotificationWrapper (finalObject , PackageName , context );
718705 case "Pushy" -> {
719- if (!prefs .getString ("ApiKey_Pushy" , "" ).equals ( "" ))
706+ if (!prefs .getString ("ApiKey_Pushy" , "" ).isEmpty ( ))
720707 sendPushyNotification (finalObject , PackageName , context );
721708 }
722709 default -> {
0 commit comments