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

Commit cdb57aeb authored by John Spurlock's avatar John Spurlock
Browse files

Allow sysui-managed remote volume controllers.

- Relax restriction on audio service calls that assume the volume
  ui is systemui, allow calls from a blessed component app.
- Blessed component app service saved in secure settings.
- SystemUI mediates requests to replace the volume dialog, prompts
  the user on activation.
- Show a low pri ongoing notification when the volume dialog is
  being replaced, to allow user restoration at any time.
- Replace the controller management code in VolumeUI to use a
  ServiceMonitor, backed by the new blessed app component setting.
- Add proper zen-related noman client wrappers, make avail to the
  registered volume controller.
- Everything is still @hidden, no api impact.

Bug: 19260237
Change-Id: Ie1383f57659090318a7eda737fdad5b8f88737d4
parent ad680d46
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ interface INotificationManager

    ZenModeConfig getZenModeConfig();
    boolean setZenModeConfig(in ZenModeConfig config);
    oneway void setZenMode(int mode);
    oneway void notifyConditions(String pkg, in IConditionProvider provider, in Condition[] conditions);
    oneway void requestZenModeConditions(in IConditionListener callback, int relevance);
    oneway void setZenModeCondition(in Condition condition);
+51 −0
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.StrictMode;
import android.os.UserHandle;
import android.service.notification.Condition;
import android.service.notification.IConditionListener;
import android.service.notification.ZenModeConfig;
import android.util.Log;

/**
@@ -276,5 +279,53 @@ public class NotificationManager
        }
    }

    /**
     * @hide
     */
    public void setZenMode(int mode) {
        INotificationManager service = getService();
        try {
            service.setZenMode(mode);
        } catch (RemoteException e) {
        }
    }

    /**
     * @hide
     */
    public void requestZenModeConditions(IConditionListener listener, int relevance) {
        INotificationManager service = getService();
        try {
            service.requestZenModeConditions(listener, relevance);
        } catch (RemoteException e) {
        }
    }

    /**
     * @hide
     */
    public void setZenModeCondition(Condition exitCondition) {
        INotificationManager service = getService();
        try {
            service.setZenModeCondition(exitCondition);
        } catch (RemoteException e) {
        }
    }

    /**
     * @hide
     */
    public Condition getZenModeCondition() {
        INotificationManager service = getService();
        try {
            final ZenModeConfig config = service.getZenModeConfig();
            if (config != null) {
                return config.exitCondition;
            }
        } catch (RemoteException e) {
        }
        return null;
    }

    private Context mContext;
}
+4 −0
Original line number Diff line number Diff line
@@ -4761,6 +4761,10 @@ public final class Settings {
        /** @hide */
        public static final String BAR_SERVICE_COMPONENT = "bar_service_component";

        /** @hide */
        public static final String VOLUME_CONTROLLER_SERVICE_COMPONENT
                = "volume_controller_service_component";

        /** @hide */
        public static final String IMMERSIVE_MODE_CONFIRMATIONS = "immersive_mode_confirmations";

+2 −2
Original line number Diff line number Diff line
@@ -15,8 +15,6 @@
 */
package android.media;

import android.os.IBinder;

import com.android.server.LocalServices;

/**
@@ -47,6 +45,8 @@ public abstract class AudioManagerInternal {

    public abstract void setRingerModeInternal(int ringerMode, String caller);

    public abstract int getVolumeControllerUid();

    public interface RingerModeDelegate {
        /** Called when external ringer mode is evaluated, returns the new internal ringer mode */
        int onSetRingerModeExternal(int ringerModeOld, int ringerModeNew, String caller,
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
    <item type="id" name="notification_power"/>
    <item type="id" name="notification_screenshot"/>
    <item type="id" name="notification_hidden"/>
    <item type="id" name="notification_volumeui"/>

    <!-- Whether the icon is from a notification for which targetSdk < L -->
    <item type="id" name="icon_is_pre_L"/>
Loading