Search in sources :

Example 1 with TileLifecycleManager

use of com.android.systemui.qs.external.TileLifecycleManager in project android_frameworks_base by ResurrectionRemix.

the class QSTileHost method changeTiles.

public void changeTiles(List<String> previousTiles, List<String> newTiles) {
    final int NP = previousTiles.size();
    final int NA = newTiles.size();
    for (int i = 0; i < NP; i++) {
        String tileSpec = previousTiles.get(i);
        if (!tileSpec.startsWith(CustomTile.PREFIX))
            continue;
        if (!newTiles.contains(tileSpec)) {
            ComponentName component = CustomTile.getComponentFromSpec(tileSpec);
            Intent intent = new Intent().setComponent(component);
            TileLifecycleManager lifecycleManager = new TileLifecycleManager(new Handler(), mContext, mServices, new Tile(), intent, new UserHandle(ActivityManager.getCurrentUser()));
            lifecycleManager.onStopListening();
            lifecycleManager.onTileRemoved();
            TileLifecycleManager.setTileAdded(mContext, component, false);
            lifecycleManager.flushMessagesAndUnbind();
        }
    }
    if (DEBUG)
        Log.d(TAG, "saveCurrentTiles " + newTiles);
    Secure.putStringForUser(getContext().getContentResolver(), QSTileHost.TILES_SETTING, TextUtils.join(",", newTiles), ActivityManager.getCurrentUser());
}
Also used : TileLifecycleManager(com.android.systemui.qs.external.TileLifecycleManager) UserHandle(android.os.UserHandle) Handler(android.os.Handler) HeadsUpTile(com.android.systemui.qs.tiles.HeadsUpTile) DndTile(com.android.systemui.qs.tiles.DndTile) WorkModeTile(com.android.systemui.qs.tiles.WorkModeTile) BatteryTile(com.android.systemui.qs.tiles.BatteryTile) AirplaneModeTile(com.android.systemui.qs.tiles.AirplaneModeTile) RRTile(com.android.systemui.qs.tiles.RRTile) WifiTile(com.android.systemui.qs.tiles.WifiTile) SuspendActionsTile(com.android.systemui.qs.tiles.SuspendActionsTile) ExpandedDesktopTile(com.android.systemui.qs.tiles.ExpandedDesktopTile) CustomTile(com.android.systemui.qs.external.CustomTile) CaffeineTile(com.android.systemui.qs.tiles.CaffeineTile) DataSaverTile(com.android.systemui.qs.tiles.DataSaverTile) VolumeTile(com.android.systemui.qs.tiles.VolumeTile) IntentTile(com.android.systemui.qs.tiles.IntentTile) GestureAnyWhereTile(com.android.systemui.qs.tiles.GestureAnyWhereTile) SoundTile(com.android.systemui.qs.tiles.SoundTile) PieTile(com.android.systemui.qs.tiles.PieTile) WeatherTile(com.android.systemui.qs.tiles.WeatherTile) QSTile(com.android.systemui.qs.QSTile) NfcTile(com.android.systemui.qs.tiles.NfcTile) AmbientDisplayTile(com.android.systemui.qs.tiles.AmbientDisplayTile) LteTile(com.android.systemui.qs.tiles.LteTile) NavigationBarTile(com.android.systemui.qs.tiles.NavigationBarTile) HotspotTile(com.android.systemui.qs.tiles.HotspotTile) ColorInversionTile(com.android.systemui.qs.tiles.ColorInversionTile) CellularTile(com.android.systemui.qs.tiles.CellularTile) ScreenshotTile(com.android.systemui.qs.tiles.ScreenshotTile) FlashlightTile(com.android.systemui.qs.tiles.FlashlightTile) PulseTile(com.android.systemui.qs.tiles.PulseTile) UsbTetherTile(com.android.systemui.qs.tiles.UsbTetherTile) LocaleTile(com.android.systemui.qs.tiles.LocaleTile) CompassTile(com.android.systemui.qs.tiles.CompassTile) UserTile(com.android.systemui.qs.tiles.UserTile) CastTile(com.android.systemui.qs.tiles.CastTile) Tile(android.service.quicksettings.Tile) ImeTile(com.android.systemui.qs.tiles.ImeTile) SyncTile(com.android.systemui.qs.tiles.SyncTile) RotationLockTile(com.android.systemui.qs.tiles.RotationLockTile) AppCircleBarTile(com.android.systemui.qs.tiles.AppCircleBarTile) LocationTile(com.android.systemui.qs.tiles.LocationTile) PerfProfileTile(com.android.systemui.qs.tiles.PerfProfileTile) ScreenrecordTile(com.android.systemui.qs.tiles.ScreenrecordTile) HWKeysTile(com.android.systemui.qs.tiles.HWKeysTile) RebootTile(com.android.systemui.qs.tiles.RebootTile) MusicTile(com.android.systemui.qs.tiles.MusicTile) NightDisplayTile(com.android.systemui.qs.tiles.NightDisplayTile) AdbOverNetworkTile(com.android.systemui.qs.tiles.AdbOverNetworkTile) AppPickerTile(com.android.systemui.qs.tiles.AppPickerTile) BluetoothTile(com.android.systemui.qs.tiles.BluetoothTile) ComponentName(android.content.ComponentName) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent)

Example 2 with TileLifecycleManager

use of com.android.systemui.qs.external.TileLifecycleManager in project android_frameworks_base by AOSPA.

the class QSTileHost method changeTiles.

public void changeTiles(List<String> previousTiles, List<String> newTiles) {
    final int NP = previousTiles.size();
    final int NA = newTiles.size();
    for (int i = 0; i < NP; i++) {
        String tileSpec = previousTiles.get(i);
        if (!tileSpec.startsWith(CustomTile.PREFIX))
            continue;
        if (!newTiles.contains(tileSpec)) {
            ComponentName component = CustomTile.getComponentFromSpec(tileSpec);
            Intent intent = new Intent().setComponent(component);
            TileLifecycleManager lifecycleManager = new TileLifecycleManager(new Handler(), mContext, mServices, new Tile(), intent, new UserHandle(ActivityManager.getCurrentUser()));
            lifecycleManager.onStopListening();
            lifecycleManager.onTileRemoved();
            TileLifecycleManager.setTileAdded(mContext, component, false);
            lifecycleManager.flushMessagesAndUnbind();
        }
    }
    if (DEBUG)
        Log.d(TAG, "saveCurrentTiles " + newTiles);
    Secure.putStringForUser(getContext().getContentResolver(), QSTileHost.TILES_SETTING, TextUtils.join(",", newTiles), ActivityManager.getCurrentUser());
}
Also used : TileLifecycleManager(com.android.systemui.qs.external.TileLifecycleManager) UserHandle(android.os.UserHandle) Handler(android.os.Handler) DndTile(com.android.systemui.qs.tiles.DndTile) WorkModeTile(com.android.systemui.qs.tiles.WorkModeTile) BatteryTile(com.android.systemui.qs.tiles.BatteryTile) AirplaneModeTile(com.android.systemui.qs.tiles.AirplaneModeTile) WifiTile(com.android.systemui.qs.tiles.WifiTile) CustomTile(com.android.systemui.qs.external.CustomTile) DataSaverTile(com.android.systemui.qs.tiles.DataSaverTile) IntentTile(com.android.systemui.qs.tiles.IntentTile) QSTile(com.android.systemui.qs.QSTile) NfcTile(com.android.systemui.qs.tiles.NfcTile) HotspotTile(com.android.systemui.qs.tiles.HotspotTile) ColorInversionTile(com.android.systemui.qs.tiles.ColorInversionTile) CellularTile(com.android.systemui.qs.tiles.CellularTile) FlashlightTile(com.android.systemui.qs.tiles.FlashlightTile) UserTile(com.android.systemui.qs.tiles.UserTile) CastTile(com.android.systemui.qs.tiles.CastTile) Tile(android.service.quicksettings.Tile) RotationLockTile(com.android.systemui.qs.tiles.RotationLockTile) LocationTile(com.android.systemui.qs.tiles.LocationTile) ImmersiveTile(com.android.systemui.qs.tiles.ImmersiveTile) NightDisplayTile(com.android.systemui.qs.tiles.NightDisplayTile) AlertSliderTile(com.android.systemui.qs.tiles.AlertSliderTile) BluetoothTile(com.android.systemui.qs.tiles.BluetoothTile) ComponentName(android.content.ComponentName) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent)

Example 3 with TileLifecycleManager

use of com.android.systemui.qs.external.TileLifecycleManager in project android_frameworks_base by crdroidandroid.

the class QSTileHost method changeTiles.

public void changeTiles(List<String> previousTiles, List<String> newTiles) {
    final int NP = previousTiles.size();
    final int NA = newTiles.size();
    for (int i = 0; i < NP; i++) {
        String tileSpec = previousTiles.get(i);
        if (!tileSpec.startsWith(CustomTile.PREFIX))
            continue;
        if (!newTiles.contains(tileSpec)) {
            // Get the custom tile ready to be removed
            ComponentName component = CustomTile.getComponentFromSpec(tileSpec);
            Intent intent = new Intent().setComponent(component);
            TileLifecycleManager lifecycleManager = new TileLifecycleManager(new Handler(), mContext, mServices, new Tile(), intent, new UserHandle(ActivityManager.getCurrentUser()));
            lifecycleManager.onStopListening();
            lifecycleManager.onTileRemoved();
            TileLifecycleManager.setTileAdded(mContext, component, false);
            lifecycleManager.flushMessagesAndUnbind();
        }
    }
    if (DEBUG)
        Log.d(TAG, "saveCurrentTiles " + newTiles);
    Secure.putStringForUser(getContext().getContentResolver(), QSTileHost.TILES_SETTING, TextUtils.join(",", newTiles), ActivityManager.getCurrentUser());
}
Also used : TileLifecycleManager(com.android.systemui.qs.external.TileLifecycleManager) UserHandle(android.os.UserHandle) Handler(android.os.Handler) DndTile(com.android.systemui.qs.tiles.DndTile) WorkModeTile(com.android.systemui.qs.tiles.WorkModeTile) BatteryTile(com.android.systemui.qs.tiles.BatteryTile) AirplaneModeTile(com.android.systemui.qs.tiles.AirplaneModeTile) LiveDisplayTile(com.android.systemui.qs.tiles.LiveDisplayTile) WifiTile(com.android.systemui.qs.tiles.WifiTile) ExpandedDesktopTile(com.android.systemui.qs.tiles.ExpandedDesktopTile) CustomTile(com.android.systemui.qs.external.CustomTile) DataSaverTile(com.android.systemui.qs.tiles.DataSaverTile) IntentTile(com.android.systemui.qs.tiles.IntentTile) WeatherTile(com.android.systemui.qs.tiles.WeatherTile) QSTile(com.android.systemui.qs.QSTile) NfcTile(com.android.systemui.qs.tiles.NfcTile) LteTile(com.android.systemui.qs.tiles.LteTile) NavigationBarTile(com.android.systemui.qs.tiles.NavigationBarTile) HotspotTile(com.android.systemui.qs.tiles.HotspotTile) ColorInversionTile(com.android.systemui.qs.tiles.ColorInversionTile) CellularTile(com.android.systemui.qs.tiles.CellularTile) ScreenshotTile(com.android.systemui.qs.tiles.ScreenshotTile) FlashlightTile(com.android.systemui.qs.tiles.FlashlightTile) PulseTile(com.android.systemui.qs.tiles.PulseTile) CompassTile(com.android.systemui.qs.tiles.CompassTile) UserTile(com.android.systemui.qs.tiles.UserTile) CastTile(com.android.systemui.qs.tiles.CastTile) Tile(android.service.quicksettings.Tile) ImeTile(com.android.systemui.qs.tiles.ImeTile) RotationLockTile(com.android.systemui.qs.tiles.RotationLockTile) LocationTile(com.android.systemui.qs.tiles.LocationTile) RebootTile(com.android.systemui.qs.tiles.RebootTile) MusicTile(com.android.systemui.qs.tiles.MusicTile) NightDisplayTile(com.android.systemui.qs.tiles.NightDisplayTile) BluetoothTile(com.android.systemui.qs.tiles.BluetoothTile) ComponentName(android.content.ComponentName) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent)

Example 4 with TileLifecycleManager

use of com.android.systemui.qs.external.TileLifecycleManager in project android_frameworks_base by crdroidandroid.

the class QSTileHost method removeTilesWithSamePkg.

/**
     * Remove custom tiles with the same package name
     **/
public void removeTilesWithSamePkg(String pkgName) {
    List<String> newTileSpecs = new ArrayList<>();
    newTileSpecs.addAll(mTileSpecs);
    for (String spec : mTileSpecs) {
        if (!spec.startsWith(CustomTile.PREFIX))
            continue;
        if (spec.contains(pkgName)) {
            // Get the custom tile ready to be removed
            ComponentName component = CustomTile.getComponentFromSpec(spec);
            Intent intent = new Intent().setComponent(component);
            TileLifecycleManager lifecycleManager = new TileLifecycleManager(new Handler(), mContext, mServices, new Tile(), intent, new UserHandle(ActivityManager.getCurrentUser()));
            lifecycleManager.onStopListening();
            lifecycleManager.onTileRemoved();
            lifecycleManager.flushMessagesAndUnbind();
            // Remove spec from newTileSpecs
            newTileSpecs.remove(spec);
        }
    }
    // Save into Settings
    if (newTileSpecs.size() != mTileSpecs.size()) {
        Secure.putStringForUser(getContext().getContentResolver(), QSTileHost.TILES_SETTING, TextUtils.join(",", newTileSpecs), ActivityManager.getCurrentUser());
    }
}
Also used : TileLifecycleManager(com.android.systemui.qs.external.TileLifecycleManager) UserHandle(android.os.UserHandle) ArrayList(java.util.ArrayList) Handler(android.os.Handler) DndTile(com.android.systemui.qs.tiles.DndTile) WorkModeTile(com.android.systemui.qs.tiles.WorkModeTile) BatteryTile(com.android.systemui.qs.tiles.BatteryTile) AirplaneModeTile(com.android.systemui.qs.tiles.AirplaneModeTile) LiveDisplayTile(com.android.systemui.qs.tiles.LiveDisplayTile) WifiTile(com.android.systemui.qs.tiles.WifiTile) ExpandedDesktopTile(com.android.systemui.qs.tiles.ExpandedDesktopTile) CustomTile(com.android.systemui.qs.external.CustomTile) DataSaverTile(com.android.systemui.qs.tiles.DataSaverTile) IntentTile(com.android.systemui.qs.tiles.IntentTile) WeatherTile(com.android.systemui.qs.tiles.WeatherTile) QSTile(com.android.systemui.qs.QSTile) NfcTile(com.android.systemui.qs.tiles.NfcTile) LteTile(com.android.systemui.qs.tiles.LteTile) NavigationBarTile(com.android.systemui.qs.tiles.NavigationBarTile) HotspotTile(com.android.systemui.qs.tiles.HotspotTile) ColorInversionTile(com.android.systemui.qs.tiles.ColorInversionTile) CellularTile(com.android.systemui.qs.tiles.CellularTile) ScreenshotTile(com.android.systemui.qs.tiles.ScreenshotTile) FlashlightTile(com.android.systemui.qs.tiles.FlashlightTile) PulseTile(com.android.systemui.qs.tiles.PulseTile) CompassTile(com.android.systemui.qs.tiles.CompassTile) UserTile(com.android.systemui.qs.tiles.UserTile) CastTile(com.android.systemui.qs.tiles.CastTile) Tile(android.service.quicksettings.Tile) ImeTile(com.android.systemui.qs.tiles.ImeTile) RotationLockTile(com.android.systemui.qs.tiles.RotationLockTile) LocationTile(com.android.systemui.qs.tiles.LocationTile) RebootTile(com.android.systemui.qs.tiles.RebootTile) MusicTile(com.android.systemui.qs.tiles.MusicTile) NightDisplayTile(com.android.systemui.qs.tiles.NightDisplayTile) BluetoothTile(com.android.systemui.qs.tiles.BluetoothTile) ComponentName(android.content.ComponentName) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent)

Example 5 with TileLifecycleManager

use of com.android.systemui.qs.external.TileLifecycleManager in project platform_frameworks_base by android.

the class QSTileHost method changeTiles.

public void changeTiles(List<String> previousTiles, List<String> newTiles) {
    final int NP = previousTiles.size();
    final int NA = newTiles.size();
    for (int i = 0; i < NP; i++) {
        String tileSpec = previousTiles.get(i);
        if (!tileSpec.startsWith(CustomTile.PREFIX))
            continue;
        if (!newTiles.contains(tileSpec)) {
            ComponentName component = CustomTile.getComponentFromSpec(tileSpec);
            Intent intent = new Intent().setComponent(component);
            TileLifecycleManager lifecycleManager = new TileLifecycleManager(new Handler(), mContext, mServices, new Tile(), intent, new UserHandle(ActivityManager.getCurrentUser()));
            lifecycleManager.onStopListening();
            lifecycleManager.onTileRemoved();
            TileLifecycleManager.setTileAdded(mContext, component, false);
            lifecycleManager.flushMessagesAndUnbind();
        }
    }
    if (DEBUG)
        Log.d(TAG, "saveCurrentTiles " + newTiles);
    Secure.putStringForUser(getContext().getContentResolver(), QSTileHost.TILES_SETTING, TextUtils.join(",", newTiles), ActivityManager.getCurrentUser());
}
Also used : TileLifecycleManager(com.android.systemui.qs.external.TileLifecycleManager) UserHandle(android.os.UserHandle) Handler(android.os.Handler) DndTile(com.android.systemui.qs.tiles.DndTile) WorkModeTile(com.android.systemui.qs.tiles.WorkModeTile) BatteryTile(com.android.systemui.qs.tiles.BatteryTile) AirplaneModeTile(com.android.systemui.qs.tiles.AirplaneModeTile) WifiTile(com.android.systemui.qs.tiles.WifiTile) CustomTile(com.android.systemui.qs.external.CustomTile) DataSaverTile(com.android.systemui.qs.tiles.DataSaverTile) IntentTile(com.android.systemui.qs.tiles.IntentTile) QSTile(com.android.systemui.qs.QSTile) NfcTile(com.android.systemui.qs.tiles.NfcTile) HotspotTile(com.android.systemui.qs.tiles.HotspotTile) ColorInversionTile(com.android.systemui.qs.tiles.ColorInversionTile) CellularTile(com.android.systemui.qs.tiles.CellularTile) FlashlightTile(com.android.systemui.qs.tiles.FlashlightTile) UserTile(com.android.systemui.qs.tiles.UserTile) CastTile(com.android.systemui.qs.tiles.CastTile) Tile(android.service.quicksettings.Tile) RotationLockTile(com.android.systemui.qs.tiles.RotationLockTile) LocationTile(com.android.systemui.qs.tiles.LocationTile) NightDisplayTile(com.android.systemui.qs.tiles.NightDisplayTile) BluetoothTile(com.android.systemui.qs.tiles.BluetoothTile) ComponentName(android.content.ComponentName) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent)

Aggregations

PendingIntent (android.app.PendingIntent)7 ComponentName (android.content.ComponentName)7 Intent (android.content.Intent)7 Handler (android.os.Handler)7 UserHandle (android.os.UserHandle)7 Tile (android.service.quicksettings.Tile)7 QSTile (com.android.systemui.qs.QSTile)7 CustomTile (com.android.systemui.qs.external.CustomTile)7 TileLifecycleManager (com.android.systemui.qs.external.TileLifecycleManager)7 AirplaneModeTile (com.android.systemui.qs.tiles.AirplaneModeTile)7 BatteryTile (com.android.systemui.qs.tiles.BatteryTile)7 BluetoothTile (com.android.systemui.qs.tiles.BluetoothTile)7 CastTile (com.android.systemui.qs.tiles.CastTile)7 CellularTile (com.android.systemui.qs.tiles.CellularTile)7 ColorInversionTile (com.android.systemui.qs.tiles.ColorInversionTile)7 DataSaverTile (com.android.systemui.qs.tiles.DataSaverTile)7 DndTile (com.android.systemui.qs.tiles.DndTile)7 FlashlightTile (com.android.systemui.qs.tiles.FlashlightTile)7 HotspotTile (com.android.systemui.qs.tiles.HotspotTile)7 IntentTile (com.android.systemui.qs.tiles.IntentTile)7