Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f222e643 authored by Pedlar's avatar Pedlar
Browse files

Adding support for all apps, not just ones that pulse the light

parent 6f31f461
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -124,9 +124,10 @@ public class NotificationManager
        int[] idOut = new int[1];
        INotificationManager service = getService();
        String pkg = mContext.getPackageName();
        if((notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0) {
//	Pedlar: adding support for all apps. Possibility of success?
//        if((notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0) {
        updatePackageList();
        }
//        }
        if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")");
        try {
            service.enqueueNotificationWithTag(pkg, tag, id, notification, idOut);
+35 −5
Original line number Diff line number Diff line
@@ -860,12 +860,27 @@ class NotificationManagerService extends INotificationManager.Stub
	    //updatePackageList(pkg);
            //Slog.i(TAG, "notification.lights="
            //        + ((old.notification.lights.flags & Notification.FLAG_SHOW_LIGHTS) != 0));
            if ((notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0) {
            String[] mPackage = findPackage(pkg);
	    boolean flashLight = false;
	    if(mPackage != null) {
		if(!mPackage[1].equals("none"))
			flashLight = true;
	    }
	    //if ((notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0) {
            if(flashLight) {
	        mLights.add(r);
                updateLightsLocked();
            } else {
                if (old != null
                        && ((old.notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0)) {
		if (old != null) {
               // if (old != null
               //         && ((old.notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0)) {
           		String[] mOldPackage = findPackage(old.pkg);
            		boolean flashOldLight = false;
            		if(mOldPackage != null) {
              	  		if(!mOldPackage[1].equals("none"))
                        		flashOldLight = true;
            		}
			if(flashOldLight)
				updateLightsLocked();
                }
            }
@@ -1100,6 +1115,21 @@ class NotificationManagerService extends INotificationManager.Stub
		return temp;
	}

        public String[] findPackage(String pkg) {
                String mBaseString = Settings.System.getString(mContext.getContentResolver(), Settings.System.NOTIFICATION_PACKAGE_COLORS);
                String[] mBaseArray = getArray(mBaseString);
                for(int i = 0; i < mBaseArray.length; i++) {
                        if(isNull(mBaseArray[i])) {
                                continue;
                        }
                        if(mBaseArray[i].contains(pkg)) {
                                return getPackageInfo(mBaseArray[i]);
                        }
                }
                return null;
        }


	public class StartTimerClass implements Runnable {
		private long sleepTimer;