Merge "Add API in AppWidgetServiceImpl" into tm-qpr-dev am: 9fa15007e6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20056790 Change-Id: Ie31410fb55c69593a4432d8fc9db253c57dada4e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -355,6 +355,9 @@ public class AppWidgetProviderInfo implements Parcelable {
|
|||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public ActivityInfo providerInfo;
|
public ActivityInfo providerInfo;
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public boolean isExtendedFromAppWidgetProvider;
|
||||||
|
|
||||||
public AppWidgetProviderInfo() {
|
public AppWidgetProviderInfo() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -387,6 +390,7 @@ public class AppWidgetProviderInfo implements Parcelable {
|
|||||||
this.providerInfo = in.readTypedObject(ActivityInfo.CREATOR);
|
this.providerInfo = in.readTypedObject(ActivityInfo.CREATOR);
|
||||||
this.widgetFeatures = in.readInt();
|
this.widgetFeatures = in.readInt();
|
||||||
this.descriptionRes = in.readInt();
|
this.descriptionRes = in.readInt();
|
||||||
|
this.isExtendedFromAppWidgetProvider = in.readBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -510,6 +514,7 @@ public class AppWidgetProviderInfo implements Parcelable {
|
|||||||
out.writeTypedObject(this.providerInfo, flags);
|
out.writeTypedObject(this.providerInfo, flags);
|
||||||
out.writeInt(this.widgetFeatures);
|
out.writeInt(this.widgetFeatures);
|
||||||
out.writeInt(this.descriptionRes);
|
out.writeInt(this.descriptionRes);
|
||||||
|
out.writeBoolean(this.isExtendedFromAppWidgetProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -539,6 +544,7 @@ public class AppWidgetProviderInfo implements Parcelable {
|
|||||||
that.providerInfo = this.providerInfo;
|
that.providerInfo = this.providerInfo;
|
||||||
that.widgetFeatures = this.widgetFeatures;
|
that.widgetFeatures = this.widgetFeatures;
|
||||||
that.descriptionRes = this.descriptionRes;
|
that.descriptionRes = this.descriptionRes;
|
||||||
|
that.isExtendedFromAppWidgetProvider = this.isExtendedFromAppWidgetProvider;
|
||||||
return that;
|
return that;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ interface IAppWidgetService {
|
|||||||
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
|
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
|
||||||
boolean bindRemoteViewsService(String callingPackage, int appWidgetId, in Intent intent,
|
boolean bindRemoteViewsService(String callingPackage, int appWidgetId, in Intent intent,
|
||||||
IApplicationThread caller, IBinder token, IServiceConnection connection, int flags);
|
IApplicationThread caller, IBinder token, IServiceConnection connection, int flags);
|
||||||
|
void notifyProviderInheritance(in ComponentName[] componentNames);
|
||||||
|
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
int[] getAppWidgetIds(in ComponentName providerComponent);
|
int[] getAppWidgetIds(in ComponentName providerComponent);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import static android.provider.DeviceConfig.NAMESPACE_SYSTEMUI;
|
|||||||
import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME;
|
import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.Nullable;
|
||||||
import android.annotation.UserIdInt;
|
import android.annotation.UserIdInt;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.ActivityManagerInternal;
|
import android.app.ActivityManagerInternal;
|
||||||
@@ -1472,6 +1473,40 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
|
|||||||
updateAppWidgetIds(callingPackage, appWidgetIds, views, true);
|
updateAppWidgetIds(callingPackage, appWidgetIds, views, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyProviderInheritance(@Nullable final ComponentName[] componentNames) {
|
||||||
|
final int userId = UserHandle.getCallingUserId();
|
||||||
|
if (DEBUG) {
|
||||||
|
Slog.i(TAG, "notifyProviderInheritance() " + userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (componentNames == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ComponentName componentName : componentNames) {
|
||||||
|
if (componentName == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mSecurityPolicy.enforceCallFromPackage(componentName.getPackageName());
|
||||||
|
}
|
||||||
|
synchronized (mLock) {
|
||||||
|
ensureGroupStateLoadedLocked(userId);
|
||||||
|
|
||||||
|
for (ComponentName componentName : componentNames) {
|
||||||
|
final ProviderId providerId = new ProviderId(Binder.getCallingUid(), componentName);
|
||||||
|
final Provider provider = lookupProviderLocked(providerId);
|
||||||
|
|
||||||
|
if (provider == null || provider.info == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
provider.info.isExtendedFromAppWidgetProvider = true;
|
||||||
|
}
|
||||||
|
saveGroupStateAsync(userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notifyAppWidgetViewDataChanged(String callingPackage, int[] appWidgetIds,
|
public void notifyAppWidgetViewDataChanged(String callingPackage, int[] appWidgetIds,
|
||||||
int viewId) {
|
int viewId) {
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public class AppWidgetXmlUtil {
|
|||||||
private static final String ATTR_WIDGET_CATEGORY = "widget_category";
|
private static final String ATTR_WIDGET_CATEGORY = "widget_category";
|
||||||
private static final String ATTR_WIDGET_FEATURES = "widget_features";
|
private static final String ATTR_WIDGET_FEATURES = "widget_features";
|
||||||
private static final String ATTR_DESCRIPTION_RES = "description_res";
|
private static final String ATTR_DESCRIPTION_RES = "description_res";
|
||||||
|
private static final String ATTR_PROVIDER_INHERITANCE = "provider_inheritance";
|
||||||
private static final String ATTR_OS_FINGERPRINT = "os_fingerprint";
|
private static final String ATTR_OS_FINGERPRINT = "os_fingerprint";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,6 +94,7 @@ public class AppWidgetXmlUtil {
|
|||||||
out.attributeInt(null, ATTR_WIDGET_CATEGORY, info.widgetCategory);
|
out.attributeInt(null, ATTR_WIDGET_CATEGORY, info.widgetCategory);
|
||||||
out.attributeInt(null, ATTR_WIDGET_FEATURES, info.widgetFeatures);
|
out.attributeInt(null, ATTR_WIDGET_FEATURES, info.widgetFeatures);
|
||||||
out.attributeInt(null, ATTR_DESCRIPTION_RES, info.descriptionRes);
|
out.attributeInt(null, ATTR_DESCRIPTION_RES, info.descriptionRes);
|
||||||
|
out.attributeBoolean(null, ATTR_PROVIDER_INHERITANCE, info.isExtendedFromAppWidgetProvider);
|
||||||
out.attribute(null, ATTR_OS_FINGERPRINT, Build.FINGERPRINT);
|
out.attribute(null, ATTR_OS_FINGERPRINT, Build.FINGERPRINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,6 +135,8 @@ public class AppWidgetXmlUtil {
|
|||||||
info.widgetCategory = parser.getAttributeInt(null, ATTR_WIDGET_CATEGORY, 0);
|
info.widgetCategory = parser.getAttributeInt(null, ATTR_WIDGET_CATEGORY, 0);
|
||||||
info.widgetFeatures = parser.getAttributeInt(null, ATTR_WIDGET_FEATURES, 0);
|
info.widgetFeatures = parser.getAttributeInt(null, ATTR_WIDGET_FEATURES, 0);
|
||||||
info.descriptionRes = parser.getAttributeInt(null, ATTR_DESCRIPTION_RES, 0);
|
info.descriptionRes = parser.getAttributeInt(null, ATTR_DESCRIPTION_RES, 0);
|
||||||
|
info.isExtendedFromAppWidgetProvider = parser.getAttributeBoolean(null,
|
||||||
|
ATTR_PROVIDER_INHERITANCE, false);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user