diff --git a/Android.mk b/Android.mk index 8667495..3f1db8c 100644 --- a/Android.mk +++ b/Android.mk @@ -17,8 +17,6 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ play \ libphonenumber -LOCAL_JAVA_LIBRARIES += org.cyanogenmod.hardware - # Include res dir from chips google_play_dir := ../../../external/google/google_play_services/libproject/google-play-services_lib/res res_dir := $(google_play_dir) res diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 3bed113..aeff8ca 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -68,8 +68,6 @@ android:theme="@style/Theme.Setup" android:name=".SetupWizardApp"> - - 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); }