Пример #1
0
  @Override
  protected Boolean doInBackground(Boolean... options) {
    try {
      publishProgress(R.string.mount, 1);
      Log.i(TAG, mContext.getString(R.string.mount));
      Common.mountDir(AOSPBrowserInstaller.SystemApps, "RW");

      publishProgress(R.string.backup, 2);
      if (!AOSPBrowserInstaller.bppapkold.exists() && AOSPBrowserInstaller.bppapk.exists()) {
        Log.i(TAG, mContext.getString(R.string.backup));
        move(AOSPBrowserInstaller.bppapk, AOSPBrowserInstaller.bppapkold);
      }
      if (!AOSPBrowserInstaller.bppodexold.exists() && AOSPBrowserInstaller.bppodex.exists()) {
        Log.i(TAG, mContext.getString(R.string.backup));
        move(AOSPBrowserInstaller.bppodex, AOSPBrowserInstaller.bppodexold);
      }
      publishProgress(R.string.pushbrowser, 3);
      Log.i(TAG, mContext.getString(R.string.pushbrowser));
      copy(downloaded_apk, AOSPBrowserInstaller.installed_browser);
      publishProgress(R.string.setpermissions, 4);
      Log.i(TAG, mContext.getString(R.string.setpermissions));
      Common.chmod(mShell, AOSPBrowserInstaller.installed_browser, "644");
      if (options[0] && !AOSPBrowserInstaller.chromesync.exists()) {
        publishProgress(R.string.unpacksync, 5);
        Log.i(TAG, mContext.getString(R.string.unpacksync));
        Common.pushFileFromRAW(mContext, chromesyncapk, R.raw.chromebookmarkssyncadapter, true);
        publishProgress(R.string.pushsync, 6);
        Log.i(TAG, mContext.getString(R.string.pushsync));
        move(chromesyncapk, AOSPBrowserInstaller.chromesync);
        publishProgress(R.string.setpermissions, 7);
        Log.i(TAG, mContext.getString(R.string.setpermissions));
        Common.chmod(mShell, AOSPBrowserInstaller.chromesync, "644");
      }
      publishProgress(R.string.unmount, 8);
      Log.i(TAG, mContext.getString(R.string.unmount));
      Common.mountDir(AOSPBrowserInstaller.SystemApps, "RO");

    } catch (Exception e) {
      Notifyer.showExceptionToast(mContext, TAG, e);
      Log.i(TAG, e.getMessage());
      return false;
    }
    return true;
  }
Пример #2
0
 protected void onPreExecute() {
   pDialog = new ProgressDialog(mContext);
   pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
   pDialog.setTitle(R.string.installing);
   pDialog.setMax(8);
   pDialog.setCancelable(false);
   pDialog.show();
   Log.i(TAG, "Preparing installation");
   try {
     Common.pushFileFromRAW(mContext, busybox, R.raw.busybox, true);
     Common.chmod(mShell, busybox, "741");
   } catch (Exception e) {
     e.printStackTrace();
   }
 }