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

Commit 02ab373b authored by Pedlar's avatar Pedlar Committed by Steve Kondik
Browse files

LED / Trackball notification customization support

Change-Id: I684c271f2b52af56090e8b26013c94c8c4a56b65
parent fdc4ae6b
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.app;

import java.io.FileOutputStream;

import android.content.Context;
import android.os.Binder;
import android.os.RemoteException;
@@ -23,6 +25,7 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.ServiceManager;
import android.util.Log;
import android.widget.Toast;

/**
 * Class to notify the user of events that happen.  This is how you tell
@@ -91,6 +94,21 @@ public class NotificationManager
        notify(null, id, notification);
    }

    public void updatePackageList() {
    	try {
    		if(mContext.getPackageName().equals("com.cyanogenmod.cmparts")) {
    			return;
    		}
    		//File file = new File(appContext.getFilesDir(), "trackball_lights");
    		FileOutputStream fos = mContext.openFileOutput("trackball_lights", Context.MODE_WORLD_READABLE);
    		String blank = "yes";
    		fos.write(blank.getBytes());
    		fos.close();
    	} catch(Exception e) {
    		Log.d("WriteApps", "Error: " + e.toString() );
    	}
    }

    /**
     * Persistent notification on the status bar,
     *
@@ -106,9 +124,14 @@ public class NotificationManager
        int[] idOut = new int[1];
        INotificationManager service = getService();
        String pkg = mContext.getPackageName();
        if(((notification.flags & Notification.FLAG_ONGOING_EVENT) == 0)
	|| ((notification.flags & Notification.FLAG_FOREGROUND_SERVICE) == 0)) {
		updatePackageList();
        }
        if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")");
        try {
            service.enqueueNotificationWithTag(pkg, tag, id, notification, idOut);
            //Log.i("NotificationManager", "Pulsing: " + pkg);
            if (id != idOut[0]) {
                Log.w(TAG, "notify: id corrupted: sent " + id + ", got back " + idOut[0]);
            }
+43 −1
Original line number Diff line number Diff line
@@ -2082,6 +2082,48 @@ public final class Settings {
         */
        public static final String TRACKBALL_SCREEN_ON = "trackball_screen_on";

         /**
          * Pulse notifications in Succession.  The value is boolean (1 or 0).
          * @hide
          */
         public static final String TRACKBALL_NOTIFICATION_SUCCESSION = "trackball_sucession";

         /**
          * Pulse notifications in Succession.  The value is boolean (1 or 0).
          * @hide
          */
         public static final String TRACKBALL_NOTIFICATION_RANDOM = "trackball_random_colors";

         /**
          * Pulse notifications in Succession.  The value is boolean (1 or 0).
          * @hide
          */
         public static final String TRACKBALL_NOTIFICATION_PULSE_ORDER = "trackball_pulse_in_order";

	/**
          * Beldn Notification Colors.  The value is boolean (1 or 0).
          * @hide
          */
         public static final String TRACKBALL_NOTIFICATION_BLEND_COLOR = "trackball_blend_color";

        /**
         * Trackball Notification Colors. The value is String  pkg=color|pkg=color
         * @hide
         */
        public static final String NOTIFICATION_PACKAGE_COLORS = "|";

        /**
         * Trackball Notification List. The value is String  pkg|pkg
         * @hide
         */
        public static final String NOTIFICATION_PACKAGE_LIST = "|";

        /**
         * Trackball Notification Colors Debugging. The value is boolean (1 or 0)
         * @hide
         */
        public static final String NOTIFICATION_PACKAGE_COLORS_GET_PACK = "0";

        /**
         * Whether to unlock the menu key.  The value is boolean (1 or 0).
         * @hide
+16 −8
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.os.IHardwareService;
import android.os.ServiceManager;
import android.os.Message;
import android.util.Slog;
import android.util.Log;

import java.io.File;
import java.io.FileInputStream;
@@ -101,6 +102,13 @@ public class LightsService {
            }
        }

	public void notificationPulse(int color, int onMs, int offMs) {
		synchronized (this) {
			setLightLocked(color, LIGHT_FLASH_TIMED, onMs, 1000, BRIGHTNESS_MODE_USER);
                	mH.sendMessageDelayed(Message.obtain(mH, 1, this), onMs);
		}
	}

        public void turnOff() {
            synchronized (this) {
                setLightLocked(0, LIGHT_FLASH_NONE, 0, 0, 0);
+309 −41

File changed.

Preview size limit exceeded, changes collapsed.

+4 −4
Original line number Diff line number Diff line
@@ -4693,7 +4693,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            if (localLOGV) Slog.v(
                TAG, "getTasks: max=" + maxNum + ", flags=" + flags
                + ", receiver=" + receiver);

	    /** This could be bad? Possibly, Might look into better way to do it: Pedlar
            if (checkCallingPermission(android.Manifest.permission.GET_TASKS)
                    != PackageManager.PERMISSION_GRANTED) {
                if (receiver != null) {
@@ -4710,7 +4710,7 @@ public final class ActivityManagerService extends ActivityManagerNative
                        + " requires " + android.Manifest.permission.GET_TASKS;
                Slog.w(TAG, msg);
                throw new SecurityException(msg);
            }
            } **/

            int pos = mMainStack.mHistory.size()-1;
            ActivityRecord next =
@@ -4822,8 +4822,8 @@ public final class ActivityManagerService extends ActivityManagerNative
    public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
            int flags) {
        synchronized (this) {
            enforceCallingPermission(android.Manifest.permission.GET_TASKS,
                    "getRecentTasks()");
            //enforceCallingPermission(android.Manifest.permission.GET_TASKS,
            //        "getRecentTasks()");

            IPackageManager pm = AppGlobals.getPackageManager();