修改锁屏壁纸

下面是在网上找到的,但是修改后没有效果,后面发现7.1有默认设置壁纸的地方,

@null
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java

     private Bitmap mCache;
+    private Context mContext;
     private int mCurrentUserId;
     // The user selected in the UI, or null if no user is selected or UI doesn't support selecting
     // users.
@@ -67,10 +68,11 @@ public class LockscreenWallpaper extends IWallpaperManagerCallback.Stub implemen
     public LockscreenWallpaper(Context ctx, PhoneStatusBar bar, Handler h) {
         mBar = bar;
         mH = h;
+               
         mWallpaperManager = (WallpaperManager) ctx.getSystemService(Context.WALLPAPER_SERVICE);
         mCurrentUserId = ActivityManager.getCurrentUser();
         mUpdateMonitor = KeyguardUpdateMonitor.getInstance(ctx);
-
+               mContext = ctx;
         IWallpaperManager service = IWallpaperManager.Stub.asInterface(
                 ServiceManager.getService(Context.WALLPAPER_SERVICE));
         try {
@@ -96,6 +98,24 @@ public class LockscreenWallpaper extends IWallpaperManagerCallback.Stub implemen
             mUpdateMonitor.setHasLockscreenWallpaper(result.bitmap != null);
             mCache = result.bitmap;
         }
+               if (mCache == null) {
+            try {
+                mWallpaperManager.setStream(
+                        mContext.getResources().openRawResource(com.android.internal.R.drawable.default_lock_wallpa
+                        null,
+                        true,
+                        WallpaperManager.FLAG_LOCK);
+
+                result = loadBitmap(mCurrentUserId, mSelectedUser);
+                if (result.success) {
+                    mCached = true;
+                    mUpdateMonitor.setHasLockscreenWallpaper(result.bitmap != null);
+                    mCache = result.bitmap;
+                }
+            } catch (Exception e) {
+                Log.e(TAG, "can not set default lockscreen wallpaper");
+            }
+        }
         return mCache;
 +++ 
 还有锁屏壁纸会放大的问题:
 
b/packages/apps/Launcher3/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
@@ -636,6 +636,9 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
      */
     public static DeepShortcutsContainer showForIcon(BubbleTextView icon) {
         Launcher launcher = Launcher.getLauncher(icon.getContext());
+               if(true){
+                        return null;
+               }

你可能感兴趣的:(SystemUI)