Merge "allow error notification in plugin framework to be shown in external process, such as Launcher"
This commit is contained in:
committed by
Android (Google) Code Review
commit
7e77ed63c2
@@ -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;
|
||||
@@ -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,
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user