Merge "Add an API to get active icon for screen saver" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-04-28 12:05:16 +00:00
committed by Android (Google) Code Review

View File

@@ -159,6 +159,25 @@ public class DreamBackend {
return null;
}
/**
* Gets an icon from active dream.
*/
public Drawable getActiveIcon() {
final ComponentName cn = getActiveDream();
if (cn != null) {
final PackageManager pm = mContext.getPackageManager();
try {
final ServiceInfo ri = pm.getServiceInfo(cn, 0);
if (ri != null) {
return ri.loadIcon(pm);
}
} catch (PackageManager.NameNotFoundException exc) {
return null;
}
}
return null;
}
public @WhenToDream int getWhenToDreamSetting() {
if (!isEnabled()) {
return NEVER;