コード例 #1
0
 /**
  * 避免壁纸很小出现黑屏的情况发生
  *
  * @param wallPaper
  * @return
  */
 private BitmapDrawable preventBlackScreen(Drawable wallPaper) {
   Resources resources = GOLauncherApp.getContext().getResources();
   int screenW = resources.getDisplayMetrics().widthPixels;
   int screenH = resources.getDisplayMetrics().heightPixels;
   if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
     if (screenW > screenH) {
       int temp = screenW;
       screenW = screenH;
       screenH = temp;
     }
   } else {
     if (screenW < screenH) {
       int temp = screenW;
       screenW = screenH;
       screenH = temp;
     }
   }
   boolean isWallpaperScroll =
       GOLauncherApp.getSettingControler().getScreenSettingInfo().mWallpaperScroll;
   final int screenSpan =
       isWallpaperScroll
           ? WallpaperDensityUtil.WALLPAPER_SCREENS_SPAN_WIDTH_2
           : WallpaperDensityUtil.WALLPAPER_SCREENS_SPAN_WIDTH_1;
   BitmapDrawable newWallDrawable =
       WindowControl.prepareWallpaper(
           (BitmapDrawable) wallPaper, screenW * screenSpan, screenH, resources);
   return newWallDrawable;
 }
コード例 #2
0
  private void setWindowBackground(boolean lwp) {
    Activity activity = mActivityReference.get();
    if (activity != null) {
      boolean hqDrawing = false;
      ThemeSettingInfo info = GOLauncherApp.getSettingControler().getThemeSettingInfo();
      if (info != null) {
        hqDrawing = info.mHighQualityDrawing;
        info = null;
      }

      final Window window = activity.getWindow();
      if (!lwp) {
        window.setBackgroundDrawable(null);
        if (hqDrawing) {
          window.setFormat(PixelFormat.RGBA_8888);
        } else {
          // window.setFormat(PixelFormat.RGBX_8888);//24位,不带Alpha通道
          window.setFormat(PixelFormat.RGB_565);
        }
      } else {
        window.setBackgroundDrawable(new ColorDrawable(0));
        window.setFormat(PixelFormat.TRANSPARENT);
      }
      activity = null;
    }
  }
コード例 #3
0
 /** 终止服务 */
 public static void stopService(/* Context context */ ) {
   if (true) {
     Context context = GOLauncherApp.getContext();
     Intent i = new Intent(context, FloatWindowsService.class);
     context.stopService(i);
   }
 }
コード例 #4
0
 /**
  * 防止外界app对壁纸进行了更改
  *
  * @param resources
  * @param screenWidth
  * @return
  */
 private boolean preventAmplifyWallpaper(Resources resources, int screenWidth) {
   if (mWallpaperDrawable != null) {
     mSysDrawSuport = false;
     if (mWallpaperDrawable.getIntrinsicWidth() >= screenWidth) {
       if (mLastWallPaperDrawableWidth == 0) {
         mLastWallPaperDrawableWidth = mWallpaperDrawable.getIntrinsicWidth();
       } else if (!GOLauncherApp.getSettingControler().getScreenSettingInfo().mWallpaperScroll
           && mWallpaperDrawable.getIntrinsicWidth() != mLastWallPaperDrawableWidth
           && (mWallpaperDrawable.getIntrinsicWidth() > mLastWallPaperDrawableWidth
               || mWallpaperDrawable.getIntrinsicWidth()
                   > screenWidth + SINGLE_WALLPAPER_SCREEN_SLOP)
           && mLastWallPaperDrawable != null
           && !isRecycled()) {
         int currentWallPaperWidth = mWallpaperDrawable.getIntrinsicWidth();
         mWallpaperDrawable = mLastWallPaperDrawable;
         if (resources.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
           mWallpaperDrawable = prepareOrientationChange(mWallpaperDrawable);
         }
         setWindowBackground(mSysDrawSuport);
         invokeWallPaperChange();
         mLastWallPaperDrawableWidth = currentWallPaperWidth;
         return true;
       }
       mLastWallPaperDrawable = mWallpaperDrawable;
       mLastWallPaperDrawableWidth = mWallpaperDrawable.getIntrinsicWidth();
     }
   } else {
     mSysDrawSuport = true;
     setWindowBackground(mSysDrawSuport);
     resetData();
   }
   return false;
 }
コード例 #5
0
 /**
  * 打开APK文件进行安装的方法
  *
  * @param file
  */
 private void openFile(final String filepath) {
   File file = new File(filepath);
   if (!file.exists()) {
     return;
   }
   String[] token = file.getName().split("\\.");
   String pf = token[token.length - 1];
   if (!pf.equals("apk")) {
     return;
   }
   //		// DefaultDownloadListener是通过ClassName在DownloadService的进程实例化的对象
   //		// 所以这里可以直接取得下载控制接口
   //		IDownloadService mDownloadController = IDownloadService.Stub.asInterface(DownloadService
   //				.getContext().getBinder());
   //		try {
   //			if (mDownloadController != null) {
   //				mDownloadController.addInstallPath(filepath);
   //			}
   //		} catch (RemoteException e) {
   //			// TODO Auto-generated catch block
   //			e.printStackTrace();
   //		}
   InstallManager mInstallManager = InstallManager.getInstance(GOLauncherApp.getContext());
   if (filepath != null) {
     mInstallManager.addPkgToArray(filepath);
   }
 }
コード例 #6
0
 /** 启动服务 */
 public static void beginService(/* Context context */ ) {
   if (true) {
     Log.v("TestSpeed", "FloatWindowsService beginService 1");
     Context context = GOLauncherApp.getContext();
     Intent i = new Intent(context, FloatWindowsService.class);
     context.startService(i);
   }
 }
コード例 #7
0
ファイル: TextFont.java プロジェクト: CodingPapi/smartapp-src
  @Override
  public void selfDestruct() {
    mTextFontInterfaceRef.clear();
    mTextFontInterfaceRef = null;

    GoSettingControler controler = GOLauncherApp.getSettingControler();
    controler.unRegisterObserver(this);
    controler = null;
  }
コード例 #8
0
ファイル: TextFont.java プロジェクト: CodingPapi/smartapp-src
 @Override
 public void selfConstruct() {
   GoSettingControler controler = GOLauncherApp.getSettingControler();
   if (null != controler) {
     controler.registerObserver(this);
     initTypeface(
         controler.getUsedFontBean().mFontTypeface, controler.getUsedFontBean().mFontStyle);
   }
 }
コード例 #9
0
 public static AppFuncUtils getInstance(Context context) {
   if (context == null) {
     context = GOLauncherApp.getContext();
   }
   if (sInstance == null) {
     sInstance = new AppFuncUtils(context);
   }
   return sInstance;
 }
コード例 #10
0
  private void initMemory() {
    try {
      Context context = GOLauncherApp.getContext();
      mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
      mPid = new int[] {android.os.Process.myPid()};

      Class<?> activityClass = Class.forName("android.app.ActivityManager");
      mMethod = activityClass.getDeclaredMethod("getProcessMemoryInfo", int[].class);

    } catch (Exception e) {
    }
  }
コード例 #11
0
  /**
   * 插入快捷设置,为默认主题设置
   *
   * @param info 设置信息
   */
  public void insertShortCutSetting(ShortCutSettingInfo info) {
    ContentValues values = new ContentValues();
    info.contentValues(values);
    String themeName = GOLauncherApp.getThemeManager().getCurThemePackage();
    if (null != themeName) {
      values.put(ShortcutSettingTable.THEMENAME, themeName);
    }

    // NOTE:2.16加入的新的3个字段如果要修改默认值,可以在此修改

    mDataProvider.insertShortCutSetting(values);
  }
コード例 #12
0
 // 设置超级主题的壁纸
 private void setSuperThemeWallpaper(Context context, String resName) {
   try {
     ThemeInfoBean infoBean = ThemeManager.getInstance(context).getCurThemeInfoBean();
     if (infoBean != null) {
       final String pgkName = infoBean.getPackageName();
       Resources resources =
           GOLauncherApp.getContext().getPackageManager().getResourcesForApplication(pgkName);
       final int resId = resources.getIdentifier(resName, "drawable", pgkName);
       setWallpaperInBackground(context, resources, resId);
     }
   } catch (Exception e) {
     // e.printStackTrace();
   }
 } // end setSuperThemeWallpaper
コード例 #13
0
  @Override
  public void onCreate() {
    super.onCreate();
    mContext = GOLauncherApp.getContext();
    initView();
    initMemory();

    HandlerThread thread = new HandlerThread(TAG, Process.THREAD_PRIORITY_BACKGROUND);
    thread.start();
    mServiceLooper = thread.getLooper();
    mServiceHandler = new ServiceHandler(mServiceLooper);
    mRect = new RectF();
    mPaint = new Paint();
    mPaint.setColor(0xffff0000);
  }
コード例 #14
0
    @Override
    public void run() {
      boolean needPrepare = false;
      if (mTsbSupport) {
        mWallpaperDrawable = null; // 动态壁纸
        mSysDrawSuport = true;
      } else {
        synchronized (mSupperWallpaperLock) {
          try {
            mWallpaperDrawable = null;
            mWallpaperDrawable = mWallPaperManager.getDrawable();
            Resources resources = GOLauncherApp.getContext().getResources();
            int screenWidth = resources.getDisplayMetrics().widthPixels;
            int screenHeight = resources.getDisplayMetrics().heightPixels;
            boolean needReturen = preventAmplifyWallpaper(resources, screenWidth);
            if (needReturen) {
              mSettingSupperWallpaper = false;
              return;
            }
            if (mWallpaperDrawable != null) {
              int bmpWidth = mWallpaperDrawable.getIntrinsicWidth();
              int bmpHeight = mWallpaperDrawable.getIntrinsicHeight();
              if (bmpHeight < screenHeight || bmpWidth < screenWidth) {
                mWallpaperDrawable = preventBlackScreen(mWallpaperDrawable);
              }
            }
            needPrepare = true;
          } catch (OutOfMemoryError e) {
            Log.e(TAG, "outOfMemory in updateWallpaper(boolean)" + e.getMessage());
            OutOfMemoryHandler.handle();
            resetData(); // 交由系统去处理
          } catch (Exception e) {
            mSettingSupperWallpaper = false;
            Log.e(TAG, "updateWallPaper()" + e.getMessage());
          }
          mSysDrawSuport = false;
          if (null == mWallpaperDrawable) { // 当获取壁纸失败时,交由系统自己处理
            mSysDrawSuport = true;
          }
          mHandler.sendEmptyMessage(MSG_UPDATE_WALLPAPER_TYPE);

          if (needPrepare && null != mWallpaperDrawable) { // 逻辑预处理
            mWallpaperDrawable = prepareOrientationChange(mWallpaperDrawable);
          }
          mHandler.sendEmptyMessage(MSG_UPDATE_WALLPAPER);
        } // end synchronized
      } // end else
    } // end run
コード例 #15
0
  private void handleDownloadFail(DownloadTask downloadTask) {
    long taskId = downloadTask.getId();
    String filePath = downloadTask.getSaveFilePath();
    if (filePath != null && filePath.length() > 0) {
      File saveFile = new File(filePath);
      if (saveFile.exists()) {
        saveFile.delete();
      }
    }
    IDownloadService mDownloadController = GOLauncherApp.getApplication().getDownloadController();
    try {
      if (mDownloadController != null) {
        mDownloadController.removeDownloadTaskById(taskId);
      }
    } catch (RemoteException e) {
      e.printStackTrace();
    }
    sendBroadcastingToAppCenter(downloadTask);

    // 首先移除之前的通知
    if (mNotificationManager != null) {
      // 移除之前的通知
      //			mNotificationManager.cancel(NOTIFY_TAG, (int) downloadTask.getId());
      mNotificationManager.cancel(NOTIFY_TAG, (int) downloadTask.getId());
      // 更新下载信息
      if (mShowNotification && mNotification != null) {
        mNotification.tickerText = mFailTickerText;
        mNotification.contentIntent = mPendingIntent;
        mNotification.flags = Notification.FLAG_AUTO_CANCEL;
        //				mNotificationManager.notify(NOTIFY_TAG, (int) downloadTask.getId(), mNotification);
        if (mNotification.contentView != null) {
          mNotificationManager.notify(NOTIFY_TAG, (int) downloadTask.getId(), mNotification);
        }
      }
    }
  }
コード例 #16
0
  /**
   * 调整壁纸尺寸的方法,只要是针对壁纸放大的问题(用户当前是可滚,但是选择壁纸时却是单屏,这时候设回为单屏)
   *
   * @param wallpaperManager
   * @return
   */
  public static boolean adjustWallpaperDimension(WallpaperManager wallpaperManager) {
    // 是否进行调整的结果
    boolean result = false;
    if (wallpaperManager == null) {
      wallpaperManager = WallpaperManager.getInstance(GOLauncherApp.getContext());
    }
    try {
      Method method = wallpaperManager.getClass().getMethod("getIWallpaperManager");
      Object iWallpaperManager = method.invoke(wallpaperManager);
      // Class IWallpaperManager = iWallpaperManager.getClass();
      Class iWallpaperManagerClass = Class.forName("android.app.IWallpaperManager");

      Field field = wallpaperManager.getClass().getDeclaredField("sGlobals");
      field.setAccessible(true);
      Object globals = field.get(wallpaperManager);

      Class[] arrayOfClass =
          new Class[] {Class.forName("android.app.IWallpaperManagerCallback"), Bundle.class};
      method = iWallpaperManagerClass.getDeclaredMethod("getWallpaper", arrayOfClass);
      method.setAccessible(true);

      Bundle params = new Bundle();
      ParcelFileDescriptor fd =
          (ParcelFileDescriptor) method.invoke(iWallpaperManager, new Object[] {globals, params});

      if (fd != null) {
        final int width = params.getInt("width", 0);
        final int height = params.getInt("height", 0);
        try {
          BitmapFactory.Options options = new BitmapFactory.Options();
          Bitmap bm = BitmapFactory.decodeFileDescriptor(fd.getFileDescriptor(), null, options);
          final int bitWidth = bm.getWidth();
          final int bitHeight = bm.getHeight();
          GoSettingControler settingControler = GOLauncherApp.getSettingControler();
          ScreenSettingInfo screenSettingInfo =
              GOLauncherApp.getSettingControler().getScreenSettingInfo();

          if (bitWidth == width / 2 && screenSettingInfo.mWallpaperScroll) {
            screenSettingInfo.mWallpaperScroll = false;
            result = true;
          }
          // else if(bitWidth == width * 2 &&
          // !screenSettingInfo.mWallpaperScroll){
          // screenSettingInfo.mWallpaperScroll = true;
          // result = true;
          // }
          if (result) {
            // 把屏幕是否可滚写进数据库
            settingControler.updateScreenSettingInfo(screenSettingInfo, false);
            WallpaperDensityUtil.setWallpaperDimension(GoLauncher.getContext());
          }
        } catch (OutOfMemoryError e) {
          result = false;
        } finally {
          try {
            fd.close();
          } catch (IOException e) {
            result = false;
          }
        }
      }
    } catch (Throwable e) {
      Log.v("System.out.print", e.toString());
      result = false;
    }
    return result;
  } // end adjustWallpaperDimension
コード例 #17
0
  /** 根据行列数设置Grid的规格 当规格发生改变时返回true */
  public boolean setGridStandard(int standard, XBaseGrid grid, long gridId) {
    try {
      final boolean isVertical = isVertical();
      int row = 0;
      int column = 0;
      int smallerBound = getSmallerBound();
      FunAppSetting setting = GOLauncherApp.getSettingControler().getFunAppSetting();
      switch (standard) {
        case FunAppSetting.LINECOLUMNNUMXY_SPARSE:
          {
            if (isVertical) {
              if (smallerBound <= 240) {
                row += 3;
                column += 4;
              } else {
                row += 4;
                column += 4;
              }
              if (null != grid) {
                if ((grid.getColunmNums() != column) || (grid.getRowNums() != row)) {
                  grid.setColunmNums(column);
                  grid.setRowNums(row);
                  setRCNum(column, row, gridId);
                  return true;
                }
              }
            } else {
              if (smallerBound <= 240) {
                row += 3;
                column += 4;
              } else {
                row += 3;
                column += 5;
              }
              if (null != grid) {
                if ((grid.getColunmNums() != row) || (grid.getRowNums() != column)) {
                  grid.setColunmNums(row);
                  grid.setRowNums(column);
                  setRCNum(column, row, gridId);
                  return true;
                }
              }
            }
            setRCNum(column, row, gridId);
            break;
          }
        case FunAppSetting.LINECOLUMNNUMXY_MIDDLE:
          {
            if (isVertical) {
              if (smallerBound <= 240) {
                if (gridId == AppFuncConstants.ALLAPPS_GRID) {
                  row += 4;
                } else {
                  row += 3;
                }
                column += 4;
              } else {
                row += 4;
                column += 5;
              }
              if (null != grid) {
                if ((grid.getColunmNums() != column) || (grid.getRowNums() != row)) {
                  grid.setColunmNums(column);
                  grid.setRowNums(row);
                  setRCNum(column, row, gridId);
                  return true;
                }
              }
            } else {
              row += 3;
              if (smallerBound <= 240) {
                if (gridId == AppFuncConstants.ALLAPPS_GRID) {
                  column += 5;
                } else {
                  column += 4;
                }
              } else {
                if (gridId == AppFuncConstants.ALLAPPS_GRID) {
                  column += 6;
                } else {
                  column += 5;
                }
              }
              if (null != grid) {
                if ((grid.getColunmNums() != row) || (grid.getRowNums() != column)) {
                  grid.setColunmNums(row);
                  grid.setRowNums(column);
                  setRCNum(column, row, gridId);
                  return true;
                }
              }
            }
            setRCNum(column, row, gridId);
            break;
          }
        case FunAppSetting.LINECOLUMNNUMXY_MIDDLE_2:
          {
            if (isVertical) {
              if (smallerBound <= 240) {
                if (gridId == AppFuncConstants.ALLAPPS_GRID) {
                  row += 4;
                } else {
                  row += 3;
                }
                column += 4;
              } else {
                row += 5;
                column += 4;
              }
              if (null != grid) {
                if ((grid.getColunmNums() != column) || (grid.getRowNums() != row)) {
                  grid.setColunmNums(column);
                  grid.setRowNums(row);
                  setRCNum(column, row, gridId);
                  return true;
                }
              }
            } else {
              row += 3;
              if (smallerBound <= 240) {
                if (gridId == AppFuncConstants.ALLAPPS_GRID) {
                  column += 5;
                } else {
                  column += 4;
                }
              } else {
                if (gridId == AppFuncConstants.ALLAPPS_GRID) {
                  column += 6;
                } else {
                  column += 5;
                }
              }
              if (null != grid) {
                if ((grid.getColunmNums() != row) || (grid.getRowNums() != column)) {
                  grid.setColunmNums(row);
                  grid.setRowNums(column);
                  setRCNum(column, row, gridId);
                  return true;
                }
              }
            }
            setRCNum(column, row, gridId);
            break;
          }
        case FunAppSetting.LINECOLUMNNUMXY_THICK:
          {
            if (isVertical) {
              if (smallerBound <= 240) {
                column += 5;
                if (gridId == AppFuncConstants.ALLAPPS_GRID) {
                  row += 4;
                } else {
                  row += 3;
                }
              } else {
                column += 5;
                if (gridId == AppFuncConstants.ALLAPPS_GRID) {
                  row += 5;
                } else {
                  row += 4;
                }
              }
              if (null != grid) {
                if ((grid.getColunmNums() != column) || (grid.getRowNums() != row)) {
                  grid.setColunmNums(column);
                  grid.setRowNums(row);
                  setRCNum(column, row, gridId);
                  return true;
                }
              }
            } else {
              if (smallerBound <= 240) {
                row += 4;
                if (gridId == AppFuncConstants.ALLAPPS_GRID) {
                  column += 5;
                } else {
                  column += 4;
                }
              } else {
                row += 4;
                if (gridId == AppFuncConstants.ALLAPPS_GRID) {
                  column += 6;
                } else {
                  column += 5;
                }
              }
              if (null != grid) {
                if ((grid.getColunmNums() != row) || (grid.getRowNums() != column)) {
                  // 横屏时列代表实际行,行代表实际列
                  grid.setColunmNums(row);
                  grid.setRowNums(column);
                  setRCNum(column, row, gridId);
                  return true;
                }
              }
            }
            setRCNum(column, row, gridId);
            break;
          }
        case FunAppSetting.LINECOLUMNNUMXY_DIY:
          {
            // 功能表设置数据
            if (grid != null) {
              if (isVertical) {
                grid.setColunmNums(setting.getColNum());
                grid.setRowNums(setting.getRowNum());
              } else {
                grid.setColunmNums(setting.getRowNum());
                grid.setRowNums(setting.getColNum());
              }
            }
            return true;
          }
        case FunAppSetting.LINECOLUMNNUMXY_AUTO_FIT:
          {
            AppFuncAutoFitManager autoFitMgr = AppFuncAutoFitManager.getInstance(mContext);
            if (grid != null) {
              if (isVertical) {
                grid.setColunmNums(autoFitMgr.getAppDrawerColumnsV());
                grid.setRowNums(autoFitMgr.getAppDrawerRowsV());
              } else {
                grid.setRowNums(autoFitMgr.getAppDrawerColumnsH());
                grid.setColunmNums(autoFitMgr.getAppDrawerRowsH());
              }
            }
            break;
          }
        default:
          {
            if (isVertical()) {
              if (smallerBound <= 240) {
                row += 3;
                column += 4;
              } else {
                row += 4;
                column += 4;
              }
              if (null != grid) {
                if ((grid.getColunmNums() != column) || (grid.getRowNums() != row)) {
                  grid.setColunmNums(column);
                  grid.setRowNums(row);
                  setRCNum(column, row, gridId);
                  return true;
                }
              }

            } else {
              if (smallerBound <= 240) {
                row += 3;
                column += 4;
              } else {
                row += 3;
                column += 5;
              }
              if (null != grid) {
                if ((grid.getColunmNums() != row) || (grid.getRowNums() != column)) {
                  grid.setColunmNums(row);
                  grid.setRowNums(column);
                  setRCNum(column, row, gridId);
                  return true;
                }
              }
            }
            break;
          }
      }
    } catch (NullPointerException e) {
      e.printStackTrace();
    }
    return false;
  }
コード例 #18
0
  /**
   * 获取功能表文件夹列数
   *
   * @param standard 竖屏时是设置项参数,横屏时是图标宽度
   * @return
   */
  public int getFolderColumn(int standard) {
    int column = 0;
    try {
      final boolean isVertical = isVertical();
      column = 0;
      int smallerBound = getSmallerBound();

      if (isVertical) {
        switch (standard) {
          case FunAppSetting.LINECOLUMNNUMXY_SPARSE:
            {
              if (smallerBound <= 240) {
                column += 4;
              } else {
                column += 4;
              }
              break;
            }
          case FunAppSetting.LINECOLUMNNUMXY_MIDDLE:
            {
              if (smallerBound <= 240) {
                column += 4;
              } else {
                column += 5;
              }
              break;
            }
          case FunAppSetting.LINECOLUMNNUMXY_MIDDLE_2:
            {
              if (smallerBound <= 240) {
                column += 4;
              } else {
                column += 4;
              }
              break;
            }
          case FunAppSetting.LINECOLUMNNUMXY_THICK:
            {
              if (smallerBound <= 240) {
                column += 5;
              } else {
                column += 5;
              }
              break;
            }
          case FunAppSetting.LINECOLUMNNUMXY_DIY:
            {
              // 功能表设置数据
              FunAppSetting setting = GOLauncherApp.getSettingControler().getFunAppSetting();
              column = setting.getColNum();

              break;
            }
          default:
            {
              if (smallerBound <= 240) {
                column += 4;
              } else {
                column += 4;
              }
              break;
            }
        }
      } else {
        column = (getLongerBound() - getStatusBarHeight()) / standard;
      }
    } catch (NullPointerException e) {
      column = 4;
      e.printStackTrace();
    }
    return column;
  }
コード例 #19
0
 public void updateWallpaper(boolean fromIntentReceiver) {
   boolean needPrepare = false;
   boolean hasException = false;
   Object wallpaperInfo = null;
   try {
     Method getWallpaperInfo = mWallPaperManager.getClass().getMethod("getWallpaperInfo");
     wallpaperInfo = getWallpaperInfo.invoke(mWallPaperManager);
   } catch (Throwable e) {
     hasException = true;
   }
   final boolean isLiveWallpaper = !hasException && wallpaperInfo != null ? true : false;
   boolean livecChange = false;
   if (isLiveWallpaper && wallpaperInfo instanceof WallpaperInfo) {
     String newPkgName = ((WallpaperInfo) wallpaperInfo).getPackageName();
     if (!newPkgName.equals(mLwpPkgName)) {
       mLwpPkgName = newPkgName;
       livecChange = true;
     }
   }
   if (isLiveWallpaper != mLwpSupport || livecChange) { // 壁纸动/静切换或者是动态壁纸切换动态壁纸,均需要通知更新
     mLwpSupport = isLiveWallpaper;
     if (Workspace.getLayoutScale() < 1.0f) { // 如果壁纸发生(动/静)变更并且桌面是添加状态
       // 通知添加模块添加壁纸设置选项发生变更
       GoLauncher.sendMessage(
           this,
           IDiyFrameIds.SCREEN_EDIT_BOX_FRAME,
           IDiyMsgIds.SCREEN_EDIT_UPDATE_WALLPAPER_ITEMS,
           0,
           null,
           null);
     }
   }
   synchronized (mSupperWallpaperLock) {
     if (mTsbSupport || isLiveWallpaper) {
       mWallpaperDrawable = null; // 动态壁纸
       mSysDrawSuport = true;
     } else {
       if (fromIntentReceiver || mWallpaperDrawable == null) {
         try {
           mWallpaperDrawable = null;
           mWallpaperDrawable = mWallPaperManager.getDrawable();
           Resources resources = GOLauncherApp.getContext().getResources();
           int screenWidth = resources.getDisplayMetrics().widthPixels;
           int screenHeight = resources.getDisplayMetrics().heightPixels;
           boolean needReturen = preventAmplifyWallpaper(resources, screenWidth);
           if (needReturen) {
             return;
           }
           if (mWallpaperDrawable != null) {
             int bmpWidth = mWallpaperDrawable.getIntrinsicWidth();
             int bmpHeight = mWallpaperDrawable.getIntrinsicHeight();
             if (bmpHeight < screenHeight || bmpWidth < screenWidth) {
               mWallpaperDrawable = preventBlackScreen(mWallpaperDrawable);
             }
           }
           needPrepare = true;
         } catch (OutOfMemoryError e) {
           Log.e(TAG, "outOfMemory in updateWallpaper(boolean)" + e.getMessage());
           OutOfMemoryHandler.handle();
           resetData(); // 交由系统去处理
         } catch (Exception e) {
           Log.e(TAG, "updateWallPaper()" + e.getMessage());
         }
       }
       // mLwpSupport = false;
       mSysDrawSuport = false;
       if (null == mWallpaperDrawable) { // 当获取壁纸失败时,交由系统自己处理
         // mLwpSupport = true;
         mSysDrawSuport = true;
       }
     }
     setWindowBackground(mSysDrawSuport); // 更新壁纸
     if (needPrepare && null != mWallpaperDrawable) { // 逻辑预处理
       mWallpaperDrawable = prepareOrientationChange(mWallpaperDrawable);
     }
     invokeWallPaperChange(); // 通知
     if (needPrepare && mWallpaperDrawable != null && sIsWallpaperSetting) { // 调整壁纸宽度
       sIsWallpaperSetting = false;
       adjustWallpaperDimension(mWallPaperManager);
     }
   } // end synchronized
 }