diff options
author | Scott Mertz <scott@cyngn.com> | 2015-03-03 13:04:42 -0800 |
---|---|---|
committer | Scott Mertz <scott@cyngn.com> | 2015-03-07 00:56:09 +0000 |
commit | 7732b7485d9dc145ca9093d22cb08259203719d0 (patch) | |
tree | a680610be2ffed56479c334b262cf4528a77b6fe /src/com/cyanogenmod/setupwizard/setup | |
parent | 7faec91e226676df98ff4383939933ecb34776d8 (diff) | |
download | packages_apps_SetupWizard-7732b7485d9dc145ca9093d22cb08259203719d0.zip packages_apps_SetupWizard-7732b7485d9dc145ca9093d22cb08259203719d0.tar.gz packages_apps_SetupWizard-7732b7485d9dc145ca9093d22cb08259203719d0.tar.bz2 |
SetupWizard: move to CmHardwareService
Change-Id: I9413151fe307d23196ea5736dc8c50966a43a7cc
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/setup')
-rw-r--r-- | src/com/cyanogenmod/setupwizard/setup/CyanogenSettingsPage.java | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/CyanogenSettingsPage.java b/src/com/cyanogenmod/setupwizard/setup/CyanogenSettingsPage.java index 368ada4..93ad066 100644 --- a/src/com/cyanogenmod/setupwizard/setup/CyanogenSettingsPage.java +++ b/src/com/cyanogenmod/setupwizard/setup/CyanogenSettingsPage.java @@ -23,6 +23,7 @@ import android.content.SharedPreferences; import android.content.pm.ThemeUtils; import android.content.res.ThemeConfig; import android.content.res.ThemeManager; +import android.hardware.CmHardwareManager; import android.os.Bundle; import android.os.RemoteException; import android.preference.PreferenceManager; @@ -50,8 +51,6 @@ import com.cyanogenmod.setupwizard.util.WhisperPushUtils; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesUtil; -import org.cyanogenmod.hardware.KeyDisabler; - public class CyanogenSettingsPage extends SetupPage { public static final String TAG = "CyanogenSettingsPage"; @@ -98,7 +97,9 @@ public class CyanogenSettingsPage extends SetupPage { Settings.Secure.putInt(context.getContentResolver(), Settings.Secure.DEV_FORCE_SHOW_NAVBAR, enabled ? 1 : 0); - KeyDisabler.setActive(enabled); + final CmHardwareManager cmHardwareManager = + (CmHardwareManager) context.getSystemService(Context.CMHW_SERVICE); + cmHardwareManager.set(CmHardwareManager.FEATURE_KEY_DISABLE, enabled); /* Save/restore button timeouts to disable them in softkey mode */ SharedPreferences.Editor editor = prefs.edit(); @@ -181,21 +182,16 @@ public class CyanogenSettingsPage extends SetupPage { } } - private static boolean hideKeyDisabler() { - try { - return !KeyDisabler.isSupported(); - } catch (NoClassDefFoundError e) { - // Hardware abstraction framework not installed - return true; - } + private static boolean hideKeyDisabler(Context ctx) { + final CmHardwareManager cmHardwareManager = + (CmHardwareManager) ctx.getSystemService(Context.CMHW_SERVICE); + return !cmHardwareManager.isSupported(CmHardwareManager.FEATURE_KEY_DISABLE); } - private static boolean isKeyDisablerActive() { - try { - return KeyDisabler.isActive(); - } catch (Exception e) { - return false; - } + private static boolean isKeyDisablerActive(Context ctx) { + final CmHardwareManager cmHardwareManager = + (CmHardwareManager) ctx.getSystemService(Context.CMHW_SERVICE); + return cmHardwareManager.get(CmHardwareManager.FEATURE_KEY_DISABLE); } private static boolean hideWhisperPush(Context context) { @@ -331,11 +327,11 @@ public class CyanogenSettingsPage extends SetupPage { needsNavBar = windowManager.needsNavigationBar(); } catch (RemoteException e) { } - if (hideKeyDisabler() || needsNavBar) { + if (hideKeyDisabler(getActivity()) || needsNavBar) { mNavKeysRow.setVisibility(View.GONE); } else { boolean navKeysDisabled = - isKeyDisablerActive(); + isKeyDisablerActive(getActivity()); mNavKeys.setChecked(navKeysDisabled); } |