OSDN Git Service

Merge "Move the action buttons in installed app detail page in the preference xml."
authorTreeHugger Robot <treehugger-gerrit@google.com>
Wed, 8 Mar 2017 00:30:13 +0000 (00:30 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Wed, 8 Mar 2017 00:30:14 +0000 (00:30 +0000)
1  2 
src/com/android/settings/applications/InstalledAppDetails.java

@@@ -437,27 -430,10 +434,27 @@@ public class InstalledAppDetails extend
          refreshUi();
      }
  
 +    /**
 +     * Ensures the {@link PackageInfo} is available to proceed. If it's not available, the fragment
 +     * will finish.
 +     *
 +     * @return true if packageInfo is available.
 +     */
 +    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
 +    boolean ensurePackageInfoAvailable(Activity activity) {
 +        if (mPackageInfo == null) {
 +            mFinishing = true;
 +            Log.w(LOG_TAG, "Package info not available. Is this package already uninstalled?");
 +            activity.finishAndRemoveTask();
 +            return false;
 +        }
 +        return true;
 +    }
 +
      private void prepareUninstallAndStop() {
-         mForceStopButton = (Button) mFooter.findViewById(R.id.right_button);
+         mForceStopButton = (Button) mActionButtons.findViewById(R.id.right_button);
          mForceStopButton.setText(R.string.force_stop);
-         mUninstallButton = (Button) mFooter.findViewById(R.id.left_button);
+         mUninstallButton = (Button) mActionButtons.findViewById(R.id.left_button);
          mForceStopButton.setEnabled(false);
      }