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

Commit d5a204f1 authored by Jason Monk's avatar Jason Monk
Browse files

Better service management for QS 3rd party tiles

Better wrapper around the service that will handle rebinding
when it dies, binding when it becomes available, and forwarding
along all messages to the service once it binds.

Also better handling of too many services at a time.  Will only
ever bind to at most 3 tiles and will manage which ones are most
important to show based on pending clicks, last update, etc.

Change-Id: I5f4da0bc751f7eb25baa32e5c0bb9f1bc418f5bb
parent 56a99538
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -26,17 +26,17 @@ import android.os.RemoteException;
import android.view.WindowManager;

/**
 * A QSTileService provides the user a tile that can be added to Quick Settings.
 * A TileService provides the user a tile that can be added to Quick Settings.
 * Quick Settings is a space provided that allows the user to change settings and
 * take quick actions without leaving the context of their current app.
 *
 * <p>The lifecycle of a QSTileService is different from some other services in
 * <p>The lifecycle of a TileService is different from some other services in
 * that it may be unbound during parts of its lifecycle.  Any of the following
 * lifecycle events can happen indepently in a separate binding/creation of the
 * service.</p>
 *
 * <ul>
 * <li>When a tile is added by the user its QSTileService will be bound to and
 * <li>When a tile is added by the user its TileService will be bound to and
 * {@link #onTileAdded()} will be called.</li>
 *
 * <li>When a tile should be up to date and listing will be indicated by
@@ -45,10 +45,10 @@ import android.view.WindowManager;
 * <li>When the user removes a tile from Quick Settings {@link #onStopListening()}
 * will be called.</li>
 * </ul>
 * <p>QSTileService will be detected by tiles that match the {@value #ACTION_QS_TILE}
 * <p>TileService will be detected by tiles that match the {@value #ACTION_QS_TILE}
 * and require the permission "android.permission.BIND_QUICK_SETTINGS_TILE".
 * The label and icon for the service will be used as the default label and
 * icon for the tile. Here is an example QSTileService declaration.</p>
 * icon for the tile. Here is an example TileService declaration.</p>
 * <pre class="prettyprint">
 * {@literal
 * <service
@@ -67,7 +67,7 @@ import android.view.WindowManager;
public class TileService extends Service {

    /**
     * Action that identifies a Service as being a QSTileService.
     * Action that identifies a Service as being a TileService.
     */
    public static final String ACTION_QS_TILE = "android.service.quicksettings.action.QS_TILE";

+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ public class MetricsLogger implements MetricsConstants {
    public static final int NOTIFICATION_TOPIC_NOTIFICATION = 263;
    public static final int ACTION_DEFAULT_SMS_APP_CHANGED = 264;
    public static final int QS_COLOR_MATRIX = 265;
    public static final int QS_CUSTOM = 266;

    /**
     * Logged when the user docks a window from recents by longpressing a task and dragging it to
+1 −1
Original line number Diff line number Diff line
@@ -1901,7 +1901,7 @@

    <!-- Allows an application to bind to third party quick settings tiles.
         <p>Should only be requested by the System, should be required by
         QSTileService declarations.-->
         TileService declarations.-->
    <permission android:name="android.permission.BIND_QUICK_SETTINGS_TILE"
        android:protectionLevel="signature" />

+2 −2
Original line number Diff line number Diff line
@@ -35,8 +35,8 @@ import android.view.View;
import com.android.systemui.R;
import com.android.systemui.qs.QSPanel;
import com.android.systemui.qs.QSTile;
import com.android.systemui.qs.QSTileServiceWrapper;
import com.android.systemui.qs.tiles.CustomTile;
import com.android.systemui.qs.external.QSTileServiceWrapper;
import com.android.systemui.qs.external.CustomTile;
import com.android.systemui.statusbar.phone.QSTileHost;
import com.android.systemui.tuner.TunerService;

+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ import android.widget.TextView;
import com.android.systemui.R;
import com.android.systemui.qs.QSTile;
import com.android.systemui.qs.QSTile.Icon;
import com.android.systemui.qs.tiles.CustomTile;
import com.android.systemui.qs.external.CustomTile;
import com.android.systemui.statusbar.phone.QSTileHost;
import com.android.systemui.tuner.QSPagingSwitch;

Loading