Merge "Add function to AppWidgetService for updating widget visibility" into tm-qpr-dev am: d776e8d5b3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20003665 Change-Id: Iea5183e4816b06d3ada1098966014423b322fec8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -328,6 +328,22 @@ public class AppWidgetHost {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the visibiity of all widgets associated with this host to hidden
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void setAppWidgetHidden() {
|
||||||
|
if (sService == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
sService.setAppWidgetHidden(mContextOpPackageName, mHostId);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw new RuntimeException("System server dead?", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the host's interaction handler.
|
* Set the host's interaction handler.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ interface IAppWidgetService {
|
|||||||
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
|
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
|
||||||
RemoteViews getAppWidgetViews(String callingPackage, int appWidgetId);
|
RemoteViews getAppWidgetViews(String callingPackage, int appWidgetId);
|
||||||
int[] getAppWidgetIdsForHost(String callingPackage, int hostId);
|
int[] getAppWidgetIdsForHost(String callingPackage, int hostId);
|
||||||
|
void setAppWidgetHidden(in String callingPackage, int hostId);
|
||||||
IntentSender createAppWidgetConfigIntentSender(String callingPackage, int appWidgetId,
|
IntentSender createAppWidgetConfigIntentSender(String callingPackage, int appWidgetId,
|
||||||
int intentFlags);
|
int intentFlags);
|
||||||
|
|
||||||
|
|||||||
@@ -865,6 +865,33 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAppWidgetHidden(String callingPackage, int hostId) {
|
||||||
|
final int userId = UserHandle.getCallingUserId();
|
||||||
|
|
||||||
|
if (DEBUG) {
|
||||||
|
Slog.i(TAG, "setAppWidgetHidden() " + userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
mSecurityPolicy.enforceCallFromPackage(callingPackage);
|
||||||
|
|
||||||
|
synchronized (mLock) {
|
||||||
|
ensureGroupStateLoadedLocked(userId, /* enforceUserUnlockingOrUnlocked */false);
|
||||||
|
|
||||||
|
HostId id = new HostId(Binder.getCallingUid(), hostId, callingPackage);
|
||||||
|
Host host = lookupHostLocked(id);
|
||||||
|
|
||||||
|
if (host != null) {
|
||||||
|
try {
|
||||||
|
mAppOpsManagerInternal.updateAppWidgetVisibility(host.getWidgetUids(), false);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
Slog.e(TAG, "setAppWidgetHidden(): Getting host uids: " + host.toString(), e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteAppWidgetId(String callingPackage, int appWidgetId) {
|
public void deleteAppWidgetId(String callingPackage, int appWidgetId) {
|
||||||
final int userId = UserHandle.getCallingUserId();
|
final int userId = UserHandle.getCallingUserId();
|
||||||
|
|||||||
Reference in New Issue
Block a user