1 package com.android.wallpaperpicker.common;
2 
3 import android.content.Context;
4 import android.graphics.Rect;
5 
6 import java.io.IOException;
7 import java.io.InputStream;
8 
9 public abstract class WallpaperManagerCompat {
10     public static final int FLAG_SET_SYSTEM = 1 << 0; // TODO: use WallpaperManager.FLAG_SET_SYSTEM
11     public static final int FLAG_SET_LOCK = 1 << 1; // TODO: use WallpaperManager.FLAG_SET_LOCK
12 
13     private static WallpaperManagerCompat sInstance;
14     private static final Object sInstanceLock = new Object();
15 
getInstance(Context context)16     public static WallpaperManagerCompat getInstance(Context context) {
17         synchronized (sInstanceLock) {
18             if (sInstance == null) {
19                 if (Utilities.isAtLeastN()) {
20                     sInstance = new WallpaperManagerCompatVN(context.getApplicationContext());
21                 } else {
22                     sInstance = new WallpaperManagerCompatV16(context.getApplicationContext());
23                 }
24             }
25             return sInstance;
26         }
27     }
28 
setStream(InputStream stream, Rect visibleCropHint, boolean allowBackup, int whichWallpaper)29     public abstract void setStream(InputStream stream, Rect visibleCropHint, boolean allowBackup,
30             int whichWallpaper) throws IOException;
31 
clear(int whichWallpaper)32     public abstract void clear(int whichWallpaper) throws IOException;
33 }
34