Search in sources :

Example 1 with StatusBarIconController

use of com.android.systemui.statusbar.phone.StatusBarIconController in project platform_frameworks_base by android.

the class TileServices method updateStatusIcon.

@Override
public void updateStatusIcon(IBinder token, Icon icon, String contentDescription) {
    CustomTile customTile = getTileForToken(token);
    if (customTile != null) {
        verifyCaller(customTile);
        try {
            ComponentName componentName = customTile.getComponent();
            String packageName = componentName.getPackageName();
            UserHandle userHandle = getCallingUserHandle();
            PackageInfo info = mContext.getPackageManager().getPackageInfoAsUser(packageName, 0, userHandle.getIdentifier());
            if (info.applicationInfo.isSystemApp()) {
                final StatusBarIcon statusIcon = icon != null ? new StatusBarIcon(userHandle, packageName, icon, 0, 0, contentDescription) : null;
                mMainHandler.post(new Runnable() {

                    @Override
                    public void run() {
                        StatusBarIconController iconController = mHost.getIconController();
                        iconController.setIcon(componentName.getClassName(), statusIcon);
                        iconController.setExternalIcon(componentName.getClassName());
                    }
                });
            }
        } catch (PackageManager.NameNotFoundException e) {
        }
    }
}
Also used : PackageManager(android.content.pm.PackageManager) PackageInfo(android.content.pm.PackageInfo) UserHandle(android.os.UserHandle) ComponentName(android.content.ComponentName) StatusBarIcon(com.android.internal.statusbar.StatusBarIcon) StatusBarIconController(com.android.systemui.statusbar.phone.StatusBarIconController)

Example 2 with StatusBarIconController

use of com.android.systemui.statusbar.phone.StatusBarIconController in project android_frameworks_base by AOSPA.

the class TileServices method updateStatusIcon.

@Override
public void updateStatusIcon(IBinder token, Icon icon, String contentDescription) {
    CustomTile customTile = getTileForToken(token);
    if (customTile != null) {
        verifyCaller(customTile);
        try {
            ComponentName componentName = customTile.getComponent();
            String packageName = componentName.getPackageName();
            UserHandle userHandle = getCallingUserHandle();
            PackageInfo info = mContext.getPackageManager().getPackageInfoAsUser(packageName, 0, userHandle.getIdentifier());
            if (info.applicationInfo.isSystemApp()) {
                final StatusBarIcon statusIcon = icon != null ? new StatusBarIcon(userHandle, packageName, icon, 0, 0, contentDescription) : null;
                mMainHandler.post(new Runnable() {

                    @Override
                    public void run() {
                        StatusBarIconController iconController = mHost.getIconController();
                        iconController.setIcon(componentName.getClassName(), statusIcon);
                        iconController.setExternalIcon(componentName.getClassName());
                    }
                });
            }
        } catch (PackageManager.NameNotFoundException e) {
        }
    }
}
Also used : PackageManager(android.content.pm.PackageManager) PackageInfo(android.content.pm.PackageInfo) UserHandle(android.os.UserHandle) ComponentName(android.content.ComponentName) StatusBarIcon(com.android.internal.statusbar.StatusBarIcon) StatusBarIconController(com.android.systemui.statusbar.phone.StatusBarIconController)

Example 3 with StatusBarIconController

use of com.android.systemui.statusbar.phone.StatusBarIconController in project android_frameworks_base by ResurrectionRemix.

the class TileServices method updateStatusIcon.

@Override
public void updateStatusIcon(IBinder token, Icon icon, String contentDescription) {
    CustomTile customTile = getTileForToken(token);
    if (customTile != null) {
        verifyCaller(customTile);
        try {
            ComponentName componentName = customTile.getComponent();
            String packageName = componentName.getPackageName();
            UserHandle userHandle = getCallingUserHandle();
            PackageInfo info = mContext.getPackageManager().getPackageInfoAsUser(packageName, 0, userHandle.getIdentifier());
            if (info.applicationInfo.isSystemApp()) {
                final StatusBarIcon statusIcon = icon != null ? new StatusBarIcon(userHandle, packageName, icon, 0, 0, contentDescription) : null;
                mMainHandler.post(new Runnable() {

                    @Override
                    public void run() {
                        StatusBarIconController iconController = mHost.getIconController();
                        iconController.setIcon(componentName.getClassName(), statusIcon);
                        iconController.setExternalIcon(componentName.getClassName());
                    }
                });
            }
        } catch (PackageManager.NameNotFoundException e) {
        }
    }
}
Also used : PackageManager(android.content.pm.PackageManager) PackageInfo(android.content.pm.PackageInfo) UserHandle(android.os.UserHandle) ComponentName(android.content.ComponentName) StatusBarIcon(com.android.internal.statusbar.StatusBarIcon) StatusBarIconController(com.android.systemui.statusbar.phone.StatusBarIconController)

Example 4 with StatusBarIconController

use of com.android.systemui.statusbar.phone.StatusBarIconController in project android_frameworks_base by DirtyUnicorns.

the class TileServices method updateStatusIcon.

@Override
public void updateStatusIcon(IBinder token, Icon icon, String contentDescription) {
    CustomTile customTile = getTileForToken(token);
    if (customTile != null) {
        verifyCaller(customTile);
        try {
            ComponentName componentName = customTile.getComponent();
            String packageName = componentName.getPackageName();
            UserHandle userHandle = getCallingUserHandle();
            PackageInfo info = mContext.getPackageManager().getPackageInfoAsUser(packageName, 0, userHandle.getIdentifier());
            if (info.applicationInfo.isSystemApp()) {
                final StatusBarIcon statusIcon = icon != null ? new StatusBarIcon(userHandle, packageName, icon, 0, 0, contentDescription) : null;
                mMainHandler.post(new Runnable() {

                    @Override
                    public void run() {
                        StatusBarIconController iconController = mHost.getIconController();
                        iconController.setIcon(componentName.getClassName(), statusIcon);
                        iconController.setExternalIcon(componentName.getClassName());
                    }
                });
            }
        } catch (PackageManager.NameNotFoundException e) {
        }
    }
}
Also used : PackageManager(android.content.pm.PackageManager) PackageInfo(android.content.pm.PackageInfo) UserHandle(android.os.UserHandle) ComponentName(android.content.ComponentName) StatusBarIcon(com.android.internal.statusbar.StatusBarIcon) StatusBarIconController(com.android.systemui.statusbar.phone.StatusBarIconController)

Example 5 with StatusBarIconController

use of com.android.systemui.statusbar.phone.StatusBarIconController in project android_frameworks_base by crdroidandroid.

the class TileServices method updateStatusIcon.

@Override
public void updateStatusIcon(IBinder token, Icon icon, String contentDescription) {
    CustomTile customTile = getTileForToken(token);
    if (customTile != null) {
        verifyCaller(customTile);
        try {
            ComponentName componentName = customTile.getComponent();
            String packageName = componentName.getPackageName();
            UserHandle userHandle = getCallingUserHandle();
            PackageInfo info = mContext.getPackageManager().getPackageInfoAsUser(packageName, 0, userHandle.getIdentifier());
            if (info.applicationInfo.isSystemApp()) {
                final StatusBarIcon statusIcon = icon != null ? new StatusBarIcon(userHandle, packageName, icon, 0, 0, contentDescription) : null;
                mMainHandler.post(new Runnable() {

                    @Override
                    public void run() {
                        StatusBarIconController iconController = mHost.getIconController();
                        iconController.setIcon(componentName.getClassName(), statusIcon);
                        iconController.setExternalIcon(componentName.getClassName());
                    }
                });
            }
        } catch (PackageManager.NameNotFoundException e) {
        }
    }
}
Also used : PackageManager(android.content.pm.PackageManager) PackageInfo(android.content.pm.PackageInfo) UserHandle(android.os.UserHandle) ComponentName(android.content.ComponentName) StatusBarIcon(com.android.internal.statusbar.StatusBarIcon) StatusBarIconController(com.android.systemui.statusbar.phone.StatusBarIconController)

Aggregations

ComponentName (android.content.ComponentName)5 PackageInfo (android.content.pm.PackageInfo)5 PackageManager (android.content.pm.PackageManager)5 UserHandle (android.os.UserHandle)5 StatusBarIcon (com.android.internal.statusbar.StatusBarIcon)5 StatusBarIconController (com.android.systemui.statusbar.phone.StatusBarIconController)5