Skip to content

Commit

Permalink
base: properly check that quickboot is enabled
Browse files Browse the repository at this point in the history
Change-Id: I0c9e54ee2cdf4efb5097cd101a0fa274f493d816
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
  • Loading branch information
jruesga authored and Mahdi-Rom committed Jun 22, 2014
1 parent a31ff00 commit a55a1a7
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions policy/src/com/android/internal/policy/impl/GlobalActions.java
Expand Up @@ -328,27 +328,28 @@ public boolean showBeforeProvisioning() {
final ContentResolver cr = mContext.getContentResolver();
mItems = new ArrayList<Action>();

int quickbootAvailable = 1;
final PackageManager pm = mContext.getPackageManager();
try {
pm.getPackageInfo("com.qapp.quickboot", PackageManager.GET_META_DATA);
} catch (NameNotFoundException e) {
quickbootAvailable = 0;
}

final boolean quickbootEnabled = Settings.Global.getInt(
mContext.getContentResolver(), Settings.Global.ENABLE_QUICKBOOT,
quickbootAvailable) == 1;

// first: power off
mItems.add(
new SinglePressAction(
com.android.internal.R.drawable.ic_lock_power_off,
R.string.global_action_power_off) {

public void onPress() {
// Check quickboot status
boolean quickbootAvailable = false;
final PackageManager pm = mContext.getPackageManager();
try {
pm.getPackageInfo("com.qapp.quickboot", PackageManager.GET_META_DATA);
quickbootAvailable = true;
} catch (NameNotFoundException e) {
// Ignore
}
final boolean quickbootEnabled = Settings.Global.getInt(
mContext.getContentResolver(), Settings.Global.ENABLE_QUICKBOOT,
1) == 1;

// goto quickboot mode
if (quickbootEnabled) {
if (quickbootAvailable && quickbootEnabled) {
startQuickBoot();
return;
}
Expand Down

0 comments on commit a55a1a7

Please sign in to comment.