Loading packages/SystemUI/shared/src/com/android/systemui/shared/plugins/PluginInstanceManager.java +3 −5 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.os.Build; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.UserHandle; import android.util.ArraySet; import android.util.Log; import android.view.LayoutInflater; Loading Loading @@ -359,8 +358,8 @@ public class PluginInstanceManager<T extends Plugin> { if (DEBUG) Log.d(TAG, "createPlugin"); return new PluginInfo(pkg, cls, plugin, pluginContext, version); } catch (InvalidVersionException e) { final int icon = mContext.getResources().getIdentifier("tuner", "drawable", mContext.getPackageName()); final int icon = Resources.getSystem().getIdentifier( "stat_sys_warning", "drawable", "android"); final int color = Resources.getSystem().getIdentifier( "system_notification_accent_color", "color", "android"); final Notification.Builder nb = new Notification.Builder(mContext, Loading Loading @@ -392,8 +391,7 @@ public class PluginInstanceManager<T extends Plugin> { PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, i, 0); nb.addAction(new Action.Builder(null, "Disable plugin", pi).build()); mContext.getSystemService(NotificationManager.class) .notifyAsUser(cls, SystemMessage.NOTE_PLUGIN, nb.build(), UserHandle.ALL); .notify(SystemMessage.NOTE_PLUGIN, nb.build()); // TODO: Warn user. Log.w(TAG, "Plugin has invalid interface version " + plugin.getVersion() + ", expected " + mVersion); Loading packages/SystemUI/shared/src/com/android/systemui/shared/plugins/PluginManagerImpl.java +4 −5 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import android.os.Build; import android.os.Handler; import android.os.Looper; import android.os.SystemProperties; import android.os.UserHandle; import android.text.TextUtils; import android.util.ArrayMap; import android.util.ArraySet; Loading Loading @@ -235,8 +234,8 @@ public class PluginManagerImpl extends BroadcastReceiver implements PluginManage String pkg = data.getEncodedSchemeSpecificPart(); ComponentName componentName = ComponentName.unflattenFromString(pkg); if (mOneShotPackages.contains(pkg)) { int icon = mContext.getResources().getIdentifier("tuner", "drawable", mContext.getPackageName()); int icon = Resources.getSystem().getIdentifier( "stat_sys_warning", "drawable", "android"); int color = Resources.getSystem().getIdentifier( "system_notification_accent_color", "color", "android"); String label = pkg; Loading @@ -260,8 +259,8 @@ public class PluginManagerImpl extends BroadcastReceiver implements PluginManage Uri.parse("package://" + pkg)); PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, i, 0); nb.addAction(new Action.Builder(null, "Restart SysUI", pi).build()); mContext.getSystemService(NotificationManager.class).notifyAsUser(pkg, SystemMessage.NOTE_PLUGIN, nb.build(), UserHandle.ALL); mContext.getSystemService(NotificationManager.class) .notify(SystemMessage.NOTE_PLUGIN, nb.build()); } if (clearClassLoader(pkg)) { if (Build.IS_ENG) { Loading packages/SystemUI/tests/src/com/android/systemui/shared/plugins/PluginInstanceManagerTest.java +1 −3 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.os.HandlerThread; import android.os.UserHandle; import android.test.suitebuilder.annotation.SmallTest; import androidx.test.annotation.UiThreadTest; Loading Loading @@ -168,8 +167,7 @@ public class PluginInstanceManagerTest extends SysuiTestCase { // Plugin shouldn't be connected because it is the wrong version. verify(mMockListener, never()).onPluginConnected(any(), any()); verify(nm).notifyAsUser(eq(TestPlugin.class.getName()), eq(SystemMessage.NOTE_PLUGIN), any(), eq(UserHandle.ALL)); verify(nm).notify(eq(SystemMessage.NOTE_PLUGIN), any()); } @Test Loading Loading
packages/SystemUI/shared/src/com/android/systemui/shared/plugins/PluginInstanceManager.java +3 −5 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.os.Build; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.UserHandle; import android.util.ArraySet; import android.util.Log; import android.view.LayoutInflater; Loading Loading @@ -359,8 +358,8 @@ public class PluginInstanceManager<T extends Plugin> { if (DEBUG) Log.d(TAG, "createPlugin"); return new PluginInfo(pkg, cls, plugin, pluginContext, version); } catch (InvalidVersionException e) { final int icon = mContext.getResources().getIdentifier("tuner", "drawable", mContext.getPackageName()); final int icon = Resources.getSystem().getIdentifier( "stat_sys_warning", "drawable", "android"); final int color = Resources.getSystem().getIdentifier( "system_notification_accent_color", "color", "android"); final Notification.Builder nb = new Notification.Builder(mContext, Loading Loading @@ -392,8 +391,7 @@ public class PluginInstanceManager<T extends Plugin> { PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, i, 0); nb.addAction(new Action.Builder(null, "Disable plugin", pi).build()); mContext.getSystemService(NotificationManager.class) .notifyAsUser(cls, SystemMessage.NOTE_PLUGIN, nb.build(), UserHandle.ALL); .notify(SystemMessage.NOTE_PLUGIN, nb.build()); // TODO: Warn user. Log.w(TAG, "Plugin has invalid interface version " + plugin.getVersion() + ", expected " + mVersion); Loading
packages/SystemUI/shared/src/com/android/systemui/shared/plugins/PluginManagerImpl.java +4 −5 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import android.os.Build; import android.os.Handler; import android.os.Looper; import android.os.SystemProperties; import android.os.UserHandle; import android.text.TextUtils; import android.util.ArrayMap; import android.util.ArraySet; Loading Loading @@ -235,8 +234,8 @@ public class PluginManagerImpl extends BroadcastReceiver implements PluginManage String pkg = data.getEncodedSchemeSpecificPart(); ComponentName componentName = ComponentName.unflattenFromString(pkg); if (mOneShotPackages.contains(pkg)) { int icon = mContext.getResources().getIdentifier("tuner", "drawable", mContext.getPackageName()); int icon = Resources.getSystem().getIdentifier( "stat_sys_warning", "drawable", "android"); int color = Resources.getSystem().getIdentifier( "system_notification_accent_color", "color", "android"); String label = pkg; Loading @@ -260,8 +259,8 @@ public class PluginManagerImpl extends BroadcastReceiver implements PluginManage Uri.parse("package://" + pkg)); PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, i, 0); nb.addAction(new Action.Builder(null, "Restart SysUI", pi).build()); mContext.getSystemService(NotificationManager.class).notifyAsUser(pkg, SystemMessage.NOTE_PLUGIN, nb.build(), UserHandle.ALL); mContext.getSystemService(NotificationManager.class) .notify(SystemMessage.NOTE_PLUGIN, nb.build()); } if (clearClassLoader(pkg)) { if (Build.IS_ENG) { Loading
packages/SystemUI/tests/src/com/android/systemui/shared/plugins/PluginInstanceManagerTest.java +1 −3 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.os.HandlerThread; import android.os.UserHandle; import android.test.suitebuilder.annotation.SmallTest; import androidx.test.annotation.UiThreadTest; Loading Loading @@ -168,8 +167,7 @@ public class PluginInstanceManagerTest extends SysuiTestCase { // Plugin shouldn't be connected because it is the wrong version. verify(mMockListener, never()).onPluginConnected(any(), any()); verify(nm).notifyAsUser(eq(TestPlugin.class.getName()), eq(SystemMessage.NOTE_PLUGIN), any(), eq(UserHandle.ALL)); verify(nm).notify(eq(SystemMessage.NOTE_PLUGIN), any()); } @Test Loading