SetupWizard: move to CmHardwareService
Change-Id: I9413151fe307d23196ea5736dc8c50966a43a7cc
This commit is contained in:
parent
7faec91e22
commit
7732b7485d
@ -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
|
||||
|
@ -68,8 +68,6 @@
|
||||
android:theme="@style/Theme.Setup"
|
||||
android:name=".SetupWizardApp">
|
||||
|
||||
<uses-library android:name="org.cyanogenmod.hardware" android:required="false" />
|
||||
|
||||
<meta-data android:name="com.google.android.gms.version"
|
||||
android:value="@integer/google_play_services_version" />
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user