Loading Android.mk +3 −2 Original line number Diff line number Diff line Loading @@ -83,8 +83,8 @@ LOCAL_SRC_FILES += \ core/java/android/app/IStatusBar.aidl \ core/java/android/app/IThumbnailReceiver.aidl \ core/java/android/app/ITransientNotification.aidl \ core/java/android/app/IWallpaperService.aidl \ core/java/android/app/IWallpaperServiceCallback.aidl \ core/java/android/app/IWallpaperManager.aidl \ core/java/android/app/IWallpaperManagerCallback.aidl \ core/java/android/backup/IBackupManager.aidl \ core/java/android/backup/IRestoreObserver.aidl \ core/java/android/backup/IRestoreSession.aidl \ Loading Loading @@ -114,6 +114,7 @@ LOCAL_SRC_FILES += \ core/java/android/os/IParentalControlCallback.aidl \ core/java/android/os/IPermissionController.aidl \ core/java/android/os/IPowerManager.aidl \ core/java/android/service/wallpaper/IWallpaperService.aidl \ core/java/android/text/IClipboard.aidl \ core/java/android/view/accessibility/IAccessibilityManager.aidl \ core/java/android/view/accessibility/IAccessibilityManagerClient.aidl \ Loading api/current.xml +178 −8 Original line number Diff line number Diff line Loading @@ -26742,6 +26742,132 @@ </parameter> </method> </interface> <class name="WallpaperManager" extends="java.lang.Object" abstract="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <method name="clear" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="get" return="android.graphics.drawable.Drawable" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getDesiredMinimumHeight" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getDesiredMinimumWidth" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="peek" return="android.graphics.drawable.Drawable" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="set" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="resid" type="int"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="set" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="bitmap" type="android.graphics.Bitmap"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="set" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="data" type="java.io.InputStream"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="setDimensionHints" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="minimumWidth" type="int"> </parameter> <parameter name="minimumHeight" type="int"> </parameter> </method> </class> </package> <package name="android.appwidget" > Loading Loading @@ -30791,7 +30917,7 @@ synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > <exception name="IOException" type="java.io.IOException"> Loading Loading @@ -31240,7 +31366,7 @@ synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > </method> Loading @@ -31251,7 +31377,7 @@ synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > </method> Loading @@ -31262,7 +31388,7 @@ synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > </method> Loading Loading @@ -31414,7 +31540,7 @@ synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > </method> Loading Loading @@ -31581,7 +31707,7 @@ synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > <parameter name="bitmap" type="android.graphics.Bitmap"> Loading @@ -31596,7 +31722,7 @@ synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > <parameter name="data" type="java.io.InputStream"> Loading Loading @@ -115818,6 +115944,50 @@ </implements> </interface> </package> <package name="android.service.wallpaper" > <class name="WallpaperService" extends="android.app.Service" abstract="true" static="false" final="false" deprecated="not deprecated" visibility="public" > <constructor name="WallpaperService" type="android.service.wallpaper.WallpaperService" static="false" final="false" deprecated="not deprecated" visibility="public" > </constructor> <method name="onBind" return="android.os.IBinder" abstract="false" native="false" synchronized="false" static="false" final="true" deprecated="not deprecated" visibility="public" > <parameter name="intent" type="android.content.Intent"> </parameter> </method> <field name="SERVICE_INTERFACE" type="java.lang.String" transient="false" volatile="false" value=""android.service.wallpaper.WallpaperService"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> </class> </package> <package name="android.speech" > <class name="RecognizerIntent" Loading Loading @@ -146176,7 +146346,7 @@ deprecated="not deprecated" visibility="public" > <parameter name="index" type="int"> <parameter name="pointerIndex" type="int"> </parameter> </method> <method name="getPressure" core/java/android/app/ApplicationContext.java +25 −147 Original line number Diff line number Diff line Loading @@ -59,8 +59,6 @@ import android.content.res.XmlResourceParser; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.hardware.SensorManager; import android.location.ILocationManager; Loading @@ -78,7 +76,6 @@ import android.os.Handler; import android.os.IBinder; import android.os.IPowerManager; import android.os.Looper; import android.os.ParcelFileDescriptor; import android.os.PowerManager; import android.os.Process; import android.os.RemoteException; Loading @@ -88,10 +85,8 @@ import android.os.FileUtils.FileStatus; import android.telephony.TelephonyManager; import android.text.ClipboardManager; import android.util.AndroidRuntimeException; import android.util.DisplayMetrics; import android.util.Log; import android.view.ContextThemeWrapper; import android.view.Display; import android.view.LayoutInflater; import android.view.WindowManagerImpl; import android.view.accessibility.AccessibilityManager; Loading Loading @@ -165,7 +160,6 @@ class ApplicationContext extends Context { private static LocationManager sLocationManager; private static boolean sIsBluetoothDeviceCached = false; private static BluetoothDevice sBluetoothDevice; private static IWallpaperService sWallpaperService; private static final HashMap<File, SharedPreferencesImpl> sSharedPrefs = new HashMap<File, SharedPreferencesImpl>(); Loading @@ -180,8 +174,8 @@ class ApplicationContext extends Context { private Resources.Theme mTheme = null; private PackageManager mPackageManager; private NotificationManager mNotificationManager = null; private AccessibilityManager mAccessibilityManager = null; private ActivityManager mActivityManager = null; private WallpaperManager mWallpaperManager = null; private Context mReceiverRestrictedContext = null; private SearchManager mSearchManager = null; private SensorManager mSensorManager = null; Loading @@ -201,9 +195,6 @@ class ApplicationContext extends Context { private File mCacheDir; private Drawable mWallpaper; private IWallpaperServiceCallback mWallpaperCallback = null; private static long sInstanceCount = 0; private static final String[] EMPTY_FILE_LIST = {}; Loading Loading @@ -523,130 +514,37 @@ class ApplicationContext extends Context { @Override public Drawable getWallpaper() { Drawable dr = peekWallpaper(); return dr != null ? dr : getResources().getDrawable( com.android.internal.R.drawable.default_wallpaper); return getWallpaperManager().get(); } @Override public synchronized Drawable peekWallpaper() { if (mWallpaper != null) { return mWallpaper; } mWallpaperCallback = new WallpaperCallback(this); mWallpaper = getCurrentWallpaperLocked(); return mWallpaper; } private Drawable getCurrentWallpaperLocked() { try { ParcelFileDescriptor fd = getWallpaperService().getWallpaper(mWallpaperCallback); if (fd != null) { Bitmap bm = BitmapFactory.decodeFileDescriptor(fd.getFileDescriptor()); if (bm != null) { // For now clear the density until we figure out how // to deal with it for wallpapers. bm.setDensity(0); return new BitmapDrawable(getResources(), bm); } } } catch (RemoteException e) { } return null; public Drawable peekWallpaper() { return getWallpaperManager().peek(); } @Override public int getWallpaperDesiredMinimumWidth() { try { return getWallpaperService().getWidthHint(); } catch (RemoteException e) { // Shouldn't happen! return 0; } return getWallpaperManager().getDesiredMinimumWidth(); } @Override public int getWallpaperDesiredMinimumHeight() { try { return getWallpaperService().getHeightHint(); } catch (RemoteException e) { // Shouldn't happen! return 0; } return getWallpaperManager().getDesiredMinimumHeight(); } @Override public void setWallpaper(Bitmap bitmap) throws IOException { try { ParcelFileDescriptor fd = getWallpaperService().setWallpaper(null); if (fd == null) { return; } FileOutputStream fos = null; try { fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd); bitmap.compress(Bitmap.CompressFormat.PNG, 90, fos); } finally { if (fos != null) { fos.close(); } } } catch (RemoteException e) { } getWallpaperManager().set(bitmap); } @Override public void setWallpaper(InputStream data) throws IOException { try { ParcelFileDescriptor fd = getWallpaperService().setWallpaper(null); if (fd == null) { return; } FileOutputStream fos = null; try { fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd); setWallpaper(data, fos); } finally { if (fos != null) { fos.close(); } } } catch (RemoteException e) { } } private void setWallpaper(InputStream data, FileOutputStream fos) throws IOException { byte[] buffer = new byte[32768]; int amt; while ((amt=data.read(buffer)) > 0) { fos.write(buffer, 0, amt); } getWallpaperManager().set(data); } @Override public void clearWallpaper() throws IOException { try { Resources resources = getResources(); /* Set the wallpaper to the default values */ ParcelFileDescriptor fd = getWallpaperService().setWallpaper( "res:" + resources.getResourceName( com.android.internal.R.drawable.default_wallpaper)); if (fd != null) { FileOutputStream fos = null; try { fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd); setWallpaper(resources.openRawResource( com.android.internal.R.drawable.default_wallpaper), fos); } finally { if (fos != null) { fos.close(); } } } } catch (RemoteException e) { } getWallpaperManager().clear(); } @Override Loading Loading @@ -907,6 +805,8 @@ class ApplicationContext extends Context { } } else if (ACTIVITY_SERVICE.equals(name)) { return getActivityManager(); } else if (INPUT_METHOD_SERVICE.equals(name)) { return InputMethodManager.getInstance(this); } else if (ALARM_SERVICE.equals(name)) { return getAlarmManager(); } else if (ACCOUNT_SERVICE.equals(name)) { Loading Loading @@ -946,8 +846,8 @@ class ApplicationContext extends Context { return getTelephonyManager(); } else if (CLIPBOARD_SERVICE.equals(name)) { return getClipboardManager(); } else if (INPUT_METHOD_SERVICE.equals(name)) { return InputMethodManager.getInstance(this); } else if (WALLPAPER_SERVICE.equals(name)) { return getWallpaperManager(); } return null; Loading Loading @@ -1020,8 +920,7 @@ class ApplicationContext extends Context { return sWifiManager; } private NotificationManager getNotificationManager() { private NotificationManager getNotificationManager() { synchronized (mSync) { if (mNotificationManager == null) { mNotificationManager = new NotificationManager( Loading @@ -1032,6 +931,16 @@ class ApplicationContext extends Context { return mNotificationManager; } private WallpaperManager getWallpaperManager() { synchronized (mSync) { if (mWallpaperManager == null) { mWallpaperManager = new WallpaperManager(getOuterContext(), mMainThread.getHandler()); } } return mWallpaperManager; } private TelephonyManager getTelephonyManager() { synchronized (mSync) { if (mTelephonyManager == null) { Loading Loading @@ -1106,16 +1015,6 @@ class ApplicationContext extends Context { return mVibrator; } private IWallpaperService getWallpaperService() { synchronized (sSync) { if (sWallpaperService == null) { IBinder b = ServiceManager.getService(WALLPAPER_SERVICE); sWallpaperService = IWallpaperService.Stub.asInterface(b); } } return sWallpaperService; } private AudioManager getAudioManager() { if (mAudioManager == null) { Loading Loading @@ -2820,25 +2719,4 @@ class ApplicationContext extends Context { return false; } } private static class WallpaperCallback extends IWallpaperServiceCallback.Stub { private WeakReference<ApplicationContext> mContext; public WallpaperCallback(ApplicationContext context) { mContext = new WeakReference<ApplicationContext>(context); } public synchronized void onWallpaperChanged() { /* The wallpaper has changed but we shouldn't eagerly load the * wallpaper as that would be inefficient. Reset the cached wallpaper * to null so if the user requests the wallpaper again then we'll * fetch it. */ final ApplicationContext applicationContext = mContext.get(); if (applicationContext != null) { applicationContext.mWallpaper = null; } } } } core/java/android/app/IWallpaperService.aidl→core/java/android/app/IWallpaperManager.aidl +3 −3 Original line number Diff line number Diff line Loading @@ -17,10 +17,10 @@ package android.app; import android.os.ParcelFileDescriptor; import android.app.IWallpaperServiceCallback; import android.app.IWallpaperManagerCallback; /** @hide */ interface IWallpaperService { interface IWallpaperManager { /** * Set the wallpaper. Loading @@ -30,7 +30,7 @@ interface IWallpaperService { /** * Get the wallpaper. */ ParcelFileDescriptor getWallpaper(IWallpaperServiceCallback cb); ParcelFileDescriptor getWallpaper(IWallpaperManagerCallback cb); /** * Clear the wallpaper. Loading core/java/android/app/IWallpaperServiceCallback.aidl→core/java/android/app/IWallpaperManagerCallback.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -17,13 +17,13 @@ package android.app; /** * Callback interface used by IWallpaperService to send asynchronous * Callback interface used by IWallpaperManager to send asynchronous * notifications back to its clients. Note that this is a * one-way interface so the server does not block waiting for the client. * * @hide */ oneway interface IWallpaperServiceCallback { oneway interface IWallpaperManagerCallback { /** * Called when the wallpaper has changed */ Loading Loading
Android.mk +3 −2 Original line number Diff line number Diff line Loading @@ -83,8 +83,8 @@ LOCAL_SRC_FILES += \ core/java/android/app/IStatusBar.aidl \ core/java/android/app/IThumbnailReceiver.aidl \ core/java/android/app/ITransientNotification.aidl \ core/java/android/app/IWallpaperService.aidl \ core/java/android/app/IWallpaperServiceCallback.aidl \ core/java/android/app/IWallpaperManager.aidl \ core/java/android/app/IWallpaperManagerCallback.aidl \ core/java/android/backup/IBackupManager.aidl \ core/java/android/backup/IRestoreObserver.aidl \ core/java/android/backup/IRestoreSession.aidl \ Loading Loading @@ -114,6 +114,7 @@ LOCAL_SRC_FILES += \ core/java/android/os/IParentalControlCallback.aidl \ core/java/android/os/IPermissionController.aidl \ core/java/android/os/IPowerManager.aidl \ core/java/android/service/wallpaper/IWallpaperService.aidl \ core/java/android/text/IClipboard.aidl \ core/java/android/view/accessibility/IAccessibilityManager.aidl \ core/java/android/view/accessibility/IAccessibilityManagerClient.aidl \ Loading
api/current.xml +178 −8 Original line number Diff line number Diff line Loading @@ -26742,6 +26742,132 @@ </parameter> </method> </interface> <class name="WallpaperManager" extends="java.lang.Object" abstract="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <method name="clear" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="get" return="android.graphics.drawable.Drawable" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getDesiredMinimumHeight" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getDesiredMinimumWidth" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="peek" return="android.graphics.drawable.Drawable" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="set" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="resid" type="int"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="set" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="bitmap" type="android.graphics.Bitmap"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="set" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="data" type="java.io.InputStream"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="setDimensionHints" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="minimumWidth" type="int"> </parameter> <parameter name="minimumHeight" type="int"> </parameter> </method> </class> </package> <package name="android.appwidget" > Loading Loading @@ -30791,7 +30917,7 @@ synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > <exception name="IOException" type="java.io.IOException"> Loading Loading @@ -31240,7 +31366,7 @@ synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > </method> Loading @@ -31251,7 +31377,7 @@ synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > </method> Loading @@ -31262,7 +31388,7 @@ synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > </method> Loading Loading @@ -31414,7 +31540,7 @@ synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > </method> Loading Loading @@ -31581,7 +31707,7 @@ synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > <parameter name="bitmap" type="android.graphics.Bitmap"> Loading @@ -31596,7 +31722,7 @@ synchronized="false" static="false" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > <parameter name="data" type="java.io.InputStream"> Loading Loading @@ -115818,6 +115944,50 @@ </implements> </interface> </package> <package name="android.service.wallpaper" > <class name="WallpaperService" extends="android.app.Service" abstract="true" static="false" final="false" deprecated="not deprecated" visibility="public" > <constructor name="WallpaperService" type="android.service.wallpaper.WallpaperService" static="false" final="false" deprecated="not deprecated" visibility="public" > </constructor> <method name="onBind" return="android.os.IBinder" abstract="false" native="false" synchronized="false" static="false" final="true" deprecated="not deprecated" visibility="public" > <parameter name="intent" type="android.content.Intent"> </parameter> </method> <field name="SERVICE_INTERFACE" type="java.lang.String" transient="false" volatile="false" value=""android.service.wallpaper.WallpaperService"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> </class> </package> <package name="android.speech" > <class name="RecognizerIntent" Loading Loading @@ -146176,7 +146346,7 @@ deprecated="not deprecated" visibility="public" > <parameter name="index" type="int"> <parameter name="pointerIndex" type="int"> </parameter> </method> <method name="getPressure"
core/java/android/app/ApplicationContext.java +25 −147 Original line number Diff line number Diff line Loading @@ -59,8 +59,6 @@ import android.content.res.XmlResourceParser; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.hardware.SensorManager; import android.location.ILocationManager; Loading @@ -78,7 +76,6 @@ import android.os.Handler; import android.os.IBinder; import android.os.IPowerManager; import android.os.Looper; import android.os.ParcelFileDescriptor; import android.os.PowerManager; import android.os.Process; import android.os.RemoteException; Loading @@ -88,10 +85,8 @@ import android.os.FileUtils.FileStatus; import android.telephony.TelephonyManager; import android.text.ClipboardManager; import android.util.AndroidRuntimeException; import android.util.DisplayMetrics; import android.util.Log; import android.view.ContextThemeWrapper; import android.view.Display; import android.view.LayoutInflater; import android.view.WindowManagerImpl; import android.view.accessibility.AccessibilityManager; Loading Loading @@ -165,7 +160,6 @@ class ApplicationContext extends Context { private static LocationManager sLocationManager; private static boolean sIsBluetoothDeviceCached = false; private static BluetoothDevice sBluetoothDevice; private static IWallpaperService sWallpaperService; private static final HashMap<File, SharedPreferencesImpl> sSharedPrefs = new HashMap<File, SharedPreferencesImpl>(); Loading @@ -180,8 +174,8 @@ class ApplicationContext extends Context { private Resources.Theme mTheme = null; private PackageManager mPackageManager; private NotificationManager mNotificationManager = null; private AccessibilityManager mAccessibilityManager = null; private ActivityManager mActivityManager = null; private WallpaperManager mWallpaperManager = null; private Context mReceiverRestrictedContext = null; private SearchManager mSearchManager = null; private SensorManager mSensorManager = null; Loading @@ -201,9 +195,6 @@ class ApplicationContext extends Context { private File mCacheDir; private Drawable mWallpaper; private IWallpaperServiceCallback mWallpaperCallback = null; private static long sInstanceCount = 0; private static final String[] EMPTY_FILE_LIST = {}; Loading Loading @@ -523,130 +514,37 @@ class ApplicationContext extends Context { @Override public Drawable getWallpaper() { Drawable dr = peekWallpaper(); return dr != null ? dr : getResources().getDrawable( com.android.internal.R.drawable.default_wallpaper); return getWallpaperManager().get(); } @Override public synchronized Drawable peekWallpaper() { if (mWallpaper != null) { return mWallpaper; } mWallpaperCallback = new WallpaperCallback(this); mWallpaper = getCurrentWallpaperLocked(); return mWallpaper; } private Drawable getCurrentWallpaperLocked() { try { ParcelFileDescriptor fd = getWallpaperService().getWallpaper(mWallpaperCallback); if (fd != null) { Bitmap bm = BitmapFactory.decodeFileDescriptor(fd.getFileDescriptor()); if (bm != null) { // For now clear the density until we figure out how // to deal with it for wallpapers. bm.setDensity(0); return new BitmapDrawable(getResources(), bm); } } } catch (RemoteException e) { } return null; public Drawable peekWallpaper() { return getWallpaperManager().peek(); } @Override public int getWallpaperDesiredMinimumWidth() { try { return getWallpaperService().getWidthHint(); } catch (RemoteException e) { // Shouldn't happen! return 0; } return getWallpaperManager().getDesiredMinimumWidth(); } @Override public int getWallpaperDesiredMinimumHeight() { try { return getWallpaperService().getHeightHint(); } catch (RemoteException e) { // Shouldn't happen! return 0; } return getWallpaperManager().getDesiredMinimumHeight(); } @Override public void setWallpaper(Bitmap bitmap) throws IOException { try { ParcelFileDescriptor fd = getWallpaperService().setWallpaper(null); if (fd == null) { return; } FileOutputStream fos = null; try { fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd); bitmap.compress(Bitmap.CompressFormat.PNG, 90, fos); } finally { if (fos != null) { fos.close(); } } } catch (RemoteException e) { } getWallpaperManager().set(bitmap); } @Override public void setWallpaper(InputStream data) throws IOException { try { ParcelFileDescriptor fd = getWallpaperService().setWallpaper(null); if (fd == null) { return; } FileOutputStream fos = null; try { fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd); setWallpaper(data, fos); } finally { if (fos != null) { fos.close(); } } } catch (RemoteException e) { } } private void setWallpaper(InputStream data, FileOutputStream fos) throws IOException { byte[] buffer = new byte[32768]; int amt; while ((amt=data.read(buffer)) > 0) { fos.write(buffer, 0, amt); } getWallpaperManager().set(data); } @Override public void clearWallpaper() throws IOException { try { Resources resources = getResources(); /* Set the wallpaper to the default values */ ParcelFileDescriptor fd = getWallpaperService().setWallpaper( "res:" + resources.getResourceName( com.android.internal.R.drawable.default_wallpaper)); if (fd != null) { FileOutputStream fos = null; try { fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd); setWallpaper(resources.openRawResource( com.android.internal.R.drawable.default_wallpaper), fos); } finally { if (fos != null) { fos.close(); } } } } catch (RemoteException e) { } getWallpaperManager().clear(); } @Override Loading Loading @@ -907,6 +805,8 @@ class ApplicationContext extends Context { } } else if (ACTIVITY_SERVICE.equals(name)) { return getActivityManager(); } else if (INPUT_METHOD_SERVICE.equals(name)) { return InputMethodManager.getInstance(this); } else if (ALARM_SERVICE.equals(name)) { return getAlarmManager(); } else if (ACCOUNT_SERVICE.equals(name)) { Loading Loading @@ -946,8 +846,8 @@ class ApplicationContext extends Context { return getTelephonyManager(); } else if (CLIPBOARD_SERVICE.equals(name)) { return getClipboardManager(); } else if (INPUT_METHOD_SERVICE.equals(name)) { return InputMethodManager.getInstance(this); } else if (WALLPAPER_SERVICE.equals(name)) { return getWallpaperManager(); } return null; Loading Loading @@ -1020,8 +920,7 @@ class ApplicationContext extends Context { return sWifiManager; } private NotificationManager getNotificationManager() { private NotificationManager getNotificationManager() { synchronized (mSync) { if (mNotificationManager == null) { mNotificationManager = new NotificationManager( Loading @@ -1032,6 +931,16 @@ class ApplicationContext extends Context { return mNotificationManager; } private WallpaperManager getWallpaperManager() { synchronized (mSync) { if (mWallpaperManager == null) { mWallpaperManager = new WallpaperManager(getOuterContext(), mMainThread.getHandler()); } } return mWallpaperManager; } private TelephonyManager getTelephonyManager() { synchronized (mSync) { if (mTelephonyManager == null) { Loading Loading @@ -1106,16 +1015,6 @@ class ApplicationContext extends Context { return mVibrator; } private IWallpaperService getWallpaperService() { synchronized (sSync) { if (sWallpaperService == null) { IBinder b = ServiceManager.getService(WALLPAPER_SERVICE); sWallpaperService = IWallpaperService.Stub.asInterface(b); } } return sWallpaperService; } private AudioManager getAudioManager() { if (mAudioManager == null) { Loading Loading @@ -2820,25 +2719,4 @@ class ApplicationContext extends Context { return false; } } private static class WallpaperCallback extends IWallpaperServiceCallback.Stub { private WeakReference<ApplicationContext> mContext; public WallpaperCallback(ApplicationContext context) { mContext = new WeakReference<ApplicationContext>(context); } public synchronized void onWallpaperChanged() { /* The wallpaper has changed but we shouldn't eagerly load the * wallpaper as that would be inefficient. Reset the cached wallpaper * to null so if the user requests the wallpaper again then we'll * fetch it. */ final ApplicationContext applicationContext = mContext.get(); if (applicationContext != null) { applicationContext.mWallpaper = null; } } } }
core/java/android/app/IWallpaperService.aidl→core/java/android/app/IWallpaperManager.aidl +3 −3 Original line number Diff line number Diff line Loading @@ -17,10 +17,10 @@ package android.app; import android.os.ParcelFileDescriptor; import android.app.IWallpaperServiceCallback; import android.app.IWallpaperManagerCallback; /** @hide */ interface IWallpaperService { interface IWallpaperManager { /** * Set the wallpaper. Loading @@ -30,7 +30,7 @@ interface IWallpaperService { /** * Get the wallpaper. */ ParcelFileDescriptor getWallpaper(IWallpaperServiceCallback cb); ParcelFileDescriptor getWallpaper(IWallpaperManagerCallback cb); /** * Clear the wallpaper. Loading
core/java/android/app/IWallpaperServiceCallback.aidl→core/java/android/app/IWallpaperManagerCallback.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -17,13 +17,13 @@ package android.app; /** * Callback interface used by IWallpaperService to send asynchronous * Callback interface used by IWallpaperManager to send asynchronous * notifications back to its clients. Note that this is a * one-way interface so the server does not block waiting for the client. * * @hide */ oneway interface IWallpaperServiceCallback { oneway interface IWallpaperManagerCallback { /** * Called when the wallpaper has changed */ Loading