Remove built-in wallpaper picker.
Note that we don't yet have a solution for the user's initial wallpaper. Bother! Bug: 9626042 Change-Id: I07ab09a3d10434e444dc27051034d387e692e469
This commit is contained in:
committed by
Michael Jurka
parent
104c456776
commit
6241609bd6
@@ -34,37 +34,6 @@ import android.content.res.Resources;
|
||||
public class UserInitializeReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
final Resources resources = context.getResources();
|
||||
// Context.getPackageName() may return the "original" package name,
|
||||
// com.android.launcher3; Resources needs the real package name,
|
||||
// com.android.launcher3. So we ask Resources for what it thinks the
|
||||
// package name should be.
|
||||
final String packageName = resources.getResourcePackageName(R.array.wallpapers);
|
||||
ArrayList<Integer> list = new ArrayList<Integer>();
|
||||
addWallpapers(resources, packageName, R.array.wallpapers, list);
|
||||
addWallpapers(resources, packageName, R.array.extra_wallpapers, list);
|
||||
WallpaperManager wpm = (WallpaperManager) context.getSystemService(
|
||||
Context.WALLPAPER_SERVICE);
|
||||
for (int i=1; i<list.size(); i++) {
|
||||
int resid = list.get(i);
|
||||
if (!wpm.hasResourceWallpaper(resid)) {
|
||||
try {
|
||||
wpm.setResource(resid);
|
||||
} catch (IOException e) {
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addWallpapers(Resources resources, String packageName, int resid,
|
||||
ArrayList<Integer> outList) {
|
||||
final String[] extras = resources.getStringArray(resid);
|
||||
for (String extra : extras) {
|
||||
int res = resources.getIdentifier(extra, "drawable", packageName);
|
||||
if (res != 0) {
|
||||
outList.add(res);
|
||||
}
|
||||
}
|
||||
// TODO: initial wallpaper now that wallpapers are owned by another app
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user