Loading core/res/res/values/config.xml +4 −0 Original line number Original line Diff line number Diff line Loading @@ -214,4 +214,8 @@ it will be removed when the lower-level touch driver generates better it will be removed when the lower-level touch driver generates better data. --> data. --> <bool name="config_filterTouchEvents">false</bool> <bool name="config_filterTouchEvents">false</bool> <!-- Component name of the default wallpaper. This will be ImageWallpaper if not specified --> <string name="default_wallpaper_component">@null</string> </resources> </resources> services/java/com/android/server/WallpaperManagerService.java +35 −25 Original line number Original line Diff line number Diff line Loading @@ -164,7 +164,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub { if ((mLastDiedTime+MIN_WALLPAPER_CRASH_TIME) if ((mLastDiedTime+MIN_WALLPAPER_CRASH_TIME) < SystemClock.uptimeMillis()) { < SystemClock.uptimeMillis()) { Log.w(TAG, "Reverting to built-in wallpaper!"); Log.w(TAG, "Reverting to built-in wallpaper!"); bindWallpaperComponentLocked(null); bindWallpaperComponentLocked(null, false); } } } } } } Loading Loading @@ -203,11 +203,11 @@ class WallpaperManagerService extends IWallpaperManager.Stub { public void systemReady() { public void systemReady() { synchronized (mLock) { synchronized (mLock) { try { try { bindWallpaperComponentLocked(mWallpaperComponent); bindWallpaperComponentLocked(mWallpaperComponent, false); } catch (RuntimeException e) { } catch (RuntimeException e) { Log.w(TAG, "Failure starting previous wallpaper", e); Log.w(TAG, "Failure starting previous wallpaper", e); try { try { bindWallpaperComponentLocked(null); bindWallpaperComponentLocked(null, false); } catch (RuntimeException e2) { } catch (RuntimeException e2) { Log.w(TAG, "Failure starting default wallpaper", e2); Log.w(TAG, "Failure starting default wallpaper", e2); clearWallpaperComponentLocked(); clearWallpaperComponentLocked(); Loading @@ -224,7 +224,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub { } } final long ident = Binder.clearCallingIdentity(); final long ident = Binder.clearCallingIdentity(); try { try { bindWallpaperComponentLocked(null); bindWallpaperComponentLocked(null, false); } finally { } finally { Binder.restoreCallingIdentity(ident); Binder.restoreCallingIdentity(ident); } } Loading Loading @@ -307,7 +307,8 @@ class WallpaperManagerService extends IWallpaperManager.Stub { try { try { ParcelFileDescriptor pfd = updateWallpaperBitmapLocked(name); ParcelFileDescriptor pfd = updateWallpaperBitmapLocked(name); if (pfd != null) { if (pfd != null) { bindWallpaperComponentLocked(null); // Bind the wallpaper to an ImageWallpaper bindWallpaperComponentLocked(null, true); saveSettingsLocked(); saveSettingsLocked(); } } return pfd; return pfd; Loading Loading @@ -335,48 +336,57 @@ class WallpaperManagerService extends IWallpaperManager.Stub { synchronized (mLock) { synchronized (mLock) { final long ident = Binder.clearCallingIdentity(); final long ident = Binder.clearCallingIdentity(); try { try { bindWallpaperComponentLocked(name); bindWallpaperComponentLocked(name, false); } finally { } finally { Binder.restoreCallingIdentity(ident); Binder.restoreCallingIdentity(ident); } } } } } } void bindWallpaperComponentLocked(ComponentName name) { void bindWallpaperComponentLocked(ComponentName componentName, boolean isBitmap) { // Has the component changed? // Has the component changed? if (mWallpaperConnection != null) { if (mWallpaperConnection != null) { if (mWallpaperComponent == null) { if (mWallpaperComponent == null) { if (name == null) { if (componentName == null) { // Still using default wallpaper. // Still using default wallpaper. return; return; } } } else if (mWallpaperComponent.equals(name)) { } else if (mWallpaperComponent.equals(componentName)) { // Changing to same wallpaper. // Changing to same wallpaper. return; return; } } } } try { try { ComponentName realName = name; ComponentName realComponentName = componentName; if (realName == null) { if (realComponentName == null) { // The default component is our static image wallpaper. String defaultComponent = realName = new ComponentName("android", mContext.getString(com.android.internal.R.string.default_wallpaper_component); if (defaultComponent != null && !isBitmap) { // See if there is a default wallpaper component specified // Only look for this if the wallpaper is not being set to a bitmap realComponentName = ComponentName.unflattenFromString(defaultComponent); } if (realComponentName == null) { // Fall back to static image wallpaper realComponentName = new ComponentName("android", ImageWallpaper.class.getName()); ImageWallpaper.class.getName()); //clearWallpaperComponentLocked(); //clearWallpaperComponentLocked(); //return; //return; } } ServiceInfo si = mContext.getPackageManager().getServiceInfo(realName, } ServiceInfo si = mContext.getPackageManager().getServiceInfo(realComponentName, PackageManager.GET_META_DATA | PackageManager.GET_PERMISSIONS); PackageManager.GET_META_DATA | PackageManager.GET_PERMISSIONS); if (!android.Manifest.permission.BIND_WALLPAPER.equals(si.permission)) { if (!android.Manifest.permission.BIND_WALLPAPER.equals(si.permission)) { throw new SecurityException("Selected service does not require " throw new SecurityException("Selected service does not require " + android.Manifest.permission.BIND_WALLPAPER + android.Manifest.permission.BIND_WALLPAPER + ": " + realName); + ": " + realComponentName); } } WallpaperInfo wi = null; WallpaperInfo wi = null; Intent intent = new Intent(WallpaperService.SERVICE_INTERFACE); Intent intent = new Intent(WallpaperService.SERVICE_INTERFACE); if (name != null) { if (componentName != null) { // Make sure the selected service is actually a wallpaper service. // Make sure the selected service is actually a wallpaper service. List<ResolveInfo> ris = mContext.getPackageManager() List<ResolveInfo> ris = mContext.getPackageManager() .queryIntentServices(intent, PackageManager.GET_META_DATA); .queryIntentServices(intent, PackageManager.GET_META_DATA); Loading @@ -396,13 +406,13 @@ class WallpaperManagerService extends IWallpaperManager.Stub { } } if (wi == null) { if (wi == null) { throw new SecurityException("Selected service is not a wallpaper: " throw new SecurityException("Selected service is not a wallpaper: " + realName); + realComponentName); } } } } // Bind the service! // Bind the service! WallpaperConnection newConn = new WallpaperConnection(wi); WallpaperConnection newConn = new WallpaperConnection(wi); intent.setComponent(realName); intent.setComponent(realComponentName); intent.putExtra(Intent.EXTRA_CLIENT_LABEL, intent.putExtra(Intent.EXTRA_CLIENT_LABEL, com.android.internal.R.string.wallpaper_binding_label); com.android.internal.R.string.wallpaper_binding_label); intent.putExtra(Intent.EXTRA_CLIENT_INTENT, PendingIntent.getActivity( intent.putExtra(Intent.EXTRA_CLIENT_INTENT, PendingIntent.getActivity( Loading @@ -413,11 +423,11 @@ class WallpaperManagerService extends IWallpaperManager.Stub { if (!mContext.bindService(intent, newConn, if (!mContext.bindService(intent, newConn, Context.BIND_AUTO_CREATE)) { Context.BIND_AUTO_CREATE)) { throw new IllegalArgumentException("Unable to bind service: " throw new IllegalArgumentException("Unable to bind service: " + name); + componentName); } } clearWallpaperComponentLocked(); clearWallpaperComponentLocked(); mWallpaperComponent = name; mWallpaperComponent = componentName; mWallpaperConnection = newConn; mWallpaperConnection = newConn; mLastDiedTime = SystemClock.uptimeMillis(); mLastDiedTime = SystemClock.uptimeMillis(); try { try { Loading @@ -428,7 +438,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub { } } } catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) { throw new IllegalArgumentException("Unknown component " + name); throw new IllegalArgumentException("Unknown component " + componentName); } } } } Loading Loading @@ -459,7 +469,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub { mWidth, mHeight); mWidth, mHeight); } catch (RemoteException e) { } catch (RemoteException e) { Log.w(TAG, "Failed attaching wallpaper; clearing", e); Log.w(TAG, "Failed attaching wallpaper; clearing", e); bindWallpaperComponentLocked(null); bindWallpaperComponentLocked(null, false); } } } } Loading Loading
core/res/res/values/config.xml +4 −0 Original line number Original line Diff line number Diff line Loading @@ -214,4 +214,8 @@ it will be removed when the lower-level touch driver generates better it will be removed when the lower-level touch driver generates better data. --> data. --> <bool name="config_filterTouchEvents">false</bool> <bool name="config_filterTouchEvents">false</bool> <!-- Component name of the default wallpaper. This will be ImageWallpaper if not specified --> <string name="default_wallpaper_component">@null</string> </resources> </resources>
services/java/com/android/server/WallpaperManagerService.java +35 −25 Original line number Original line Diff line number Diff line Loading @@ -164,7 +164,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub { if ((mLastDiedTime+MIN_WALLPAPER_CRASH_TIME) if ((mLastDiedTime+MIN_WALLPAPER_CRASH_TIME) < SystemClock.uptimeMillis()) { < SystemClock.uptimeMillis()) { Log.w(TAG, "Reverting to built-in wallpaper!"); Log.w(TAG, "Reverting to built-in wallpaper!"); bindWallpaperComponentLocked(null); bindWallpaperComponentLocked(null, false); } } } } } } Loading Loading @@ -203,11 +203,11 @@ class WallpaperManagerService extends IWallpaperManager.Stub { public void systemReady() { public void systemReady() { synchronized (mLock) { synchronized (mLock) { try { try { bindWallpaperComponentLocked(mWallpaperComponent); bindWallpaperComponentLocked(mWallpaperComponent, false); } catch (RuntimeException e) { } catch (RuntimeException e) { Log.w(TAG, "Failure starting previous wallpaper", e); Log.w(TAG, "Failure starting previous wallpaper", e); try { try { bindWallpaperComponentLocked(null); bindWallpaperComponentLocked(null, false); } catch (RuntimeException e2) { } catch (RuntimeException e2) { Log.w(TAG, "Failure starting default wallpaper", e2); Log.w(TAG, "Failure starting default wallpaper", e2); clearWallpaperComponentLocked(); clearWallpaperComponentLocked(); Loading @@ -224,7 +224,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub { } } final long ident = Binder.clearCallingIdentity(); final long ident = Binder.clearCallingIdentity(); try { try { bindWallpaperComponentLocked(null); bindWallpaperComponentLocked(null, false); } finally { } finally { Binder.restoreCallingIdentity(ident); Binder.restoreCallingIdentity(ident); } } Loading Loading @@ -307,7 +307,8 @@ class WallpaperManagerService extends IWallpaperManager.Stub { try { try { ParcelFileDescriptor pfd = updateWallpaperBitmapLocked(name); ParcelFileDescriptor pfd = updateWallpaperBitmapLocked(name); if (pfd != null) { if (pfd != null) { bindWallpaperComponentLocked(null); // Bind the wallpaper to an ImageWallpaper bindWallpaperComponentLocked(null, true); saveSettingsLocked(); saveSettingsLocked(); } } return pfd; return pfd; Loading Loading @@ -335,48 +336,57 @@ class WallpaperManagerService extends IWallpaperManager.Stub { synchronized (mLock) { synchronized (mLock) { final long ident = Binder.clearCallingIdentity(); final long ident = Binder.clearCallingIdentity(); try { try { bindWallpaperComponentLocked(name); bindWallpaperComponentLocked(name, false); } finally { } finally { Binder.restoreCallingIdentity(ident); Binder.restoreCallingIdentity(ident); } } } } } } void bindWallpaperComponentLocked(ComponentName name) { void bindWallpaperComponentLocked(ComponentName componentName, boolean isBitmap) { // Has the component changed? // Has the component changed? if (mWallpaperConnection != null) { if (mWallpaperConnection != null) { if (mWallpaperComponent == null) { if (mWallpaperComponent == null) { if (name == null) { if (componentName == null) { // Still using default wallpaper. // Still using default wallpaper. return; return; } } } else if (mWallpaperComponent.equals(name)) { } else if (mWallpaperComponent.equals(componentName)) { // Changing to same wallpaper. // Changing to same wallpaper. return; return; } } } } try { try { ComponentName realName = name; ComponentName realComponentName = componentName; if (realName == null) { if (realComponentName == null) { // The default component is our static image wallpaper. String defaultComponent = realName = new ComponentName("android", mContext.getString(com.android.internal.R.string.default_wallpaper_component); if (defaultComponent != null && !isBitmap) { // See if there is a default wallpaper component specified // Only look for this if the wallpaper is not being set to a bitmap realComponentName = ComponentName.unflattenFromString(defaultComponent); } if (realComponentName == null) { // Fall back to static image wallpaper realComponentName = new ComponentName("android", ImageWallpaper.class.getName()); ImageWallpaper.class.getName()); //clearWallpaperComponentLocked(); //clearWallpaperComponentLocked(); //return; //return; } } ServiceInfo si = mContext.getPackageManager().getServiceInfo(realName, } ServiceInfo si = mContext.getPackageManager().getServiceInfo(realComponentName, PackageManager.GET_META_DATA | PackageManager.GET_PERMISSIONS); PackageManager.GET_META_DATA | PackageManager.GET_PERMISSIONS); if (!android.Manifest.permission.BIND_WALLPAPER.equals(si.permission)) { if (!android.Manifest.permission.BIND_WALLPAPER.equals(si.permission)) { throw new SecurityException("Selected service does not require " throw new SecurityException("Selected service does not require " + android.Manifest.permission.BIND_WALLPAPER + android.Manifest.permission.BIND_WALLPAPER + ": " + realName); + ": " + realComponentName); } } WallpaperInfo wi = null; WallpaperInfo wi = null; Intent intent = new Intent(WallpaperService.SERVICE_INTERFACE); Intent intent = new Intent(WallpaperService.SERVICE_INTERFACE); if (name != null) { if (componentName != null) { // Make sure the selected service is actually a wallpaper service. // Make sure the selected service is actually a wallpaper service. List<ResolveInfo> ris = mContext.getPackageManager() List<ResolveInfo> ris = mContext.getPackageManager() .queryIntentServices(intent, PackageManager.GET_META_DATA); .queryIntentServices(intent, PackageManager.GET_META_DATA); Loading @@ -396,13 +406,13 @@ class WallpaperManagerService extends IWallpaperManager.Stub { } } if (wi == null) { if (wi == null) { throw new SecurityException("Selected service is not a wallpaper: " throw new SecurityException("Selected service is not a wallpaper: " + realName); + realComponentName); } } } } // Bind the service! // Bind the service! WallpaperConnection newConn = new WallpaperConnection(wi); WallpaperConnection newConn = new WallpaperConnection(wi); intent.setComponent(realName); intent.setComponent(realComponentName); intent.putExtra(Intent.EXTRA_CLIENT_LABEL, intent.putExtra(Intent.EXTRA_CLIENT_LABEL, com.android.internal.R.string.wallpaper_binding_label); com.android.internal.R.string.wallpaper_binding_label); intent.putExtra(Intent.EXTRA_CLIENT_INTENT, PendingIntent.getActivity( intent.putExtra(Intent.EXTRA_CLIENT_INTENT, PendingIntent.getActivity( Loading @@ -413,11 +423,11 @@ class WallpaperManagerService extends IWallpaperManager.Stub { if (!mContext.bindService(intent, newConn, if (!mContext.bindService(intent, newConn, Context.BIND_AUTO_CREATE)) { Context.BIND_AUTO_CREATE)) { throw new IllegalArgumentException("Unable to bind service: " throw new IllegalArgumentException("Unable to bind service: " + name); + componentName); } } clearWallpaperComponentLocked(); clearWallpaperComponentLocked(); mWallpaperComponent = name; mWallpaperComponent = componentName; mWallpaperConnection = newConn; mWallpaperConnection = newConn; mLastDiedTime = SystemClock.uptimeMillis(); mLastDiedTime = SystemClock.uptimeMillis(); try { try { Loading @@ -428,7 +438,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub { } } } catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) { throw new IllegalArgumentException("Unknown component " + name); throw new IllegalArgumentException("Unknown component " + componentName); } } } } Loading Loading @@ -459,7 +469,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub { mWidth, mHeight); mWidth, mHeight); } catch (RemoteException e) { } catch (RemoteException e) { Log.w(TAG, "Failed attaching wallpaper; clearing", e); Log.w(TAG, "Failed attaching wallpaper; clearing", e); bindWallpaperComponentLocked(null); bindWallpaperComponentLocked(null, false); } } } } Loading