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 \
|
play \
|
||||||
libphonenumber
|
libphonenumber
|
||||||
|
|
||||||
LOCAL_JAVA_LIBRARIES += org.cyanogenmod.hardware
|
|
||||||
|
|
||||||
# Include res dir from chips
|
# Include res dir from chips
|
||||||
google_play_dir := ../../../external/google/google_play_services/libproject/google-play-services_lib/res
|
google_play_dir := ../../../external/google/google_play_services/libproject/google-play-services_lib/res
|
||||||
res_dir := $(google_play_dir) res
|
res_dir := $(google_play_dir) res
|
||||||
|
|
|
@ -68,8 +68,6 @@
|
||||||
android:theme="@style/Theme.Setup"
|
android:theme="@style/Theme.Setup"
|
||||||
android:name=".SetupWizardApp">
|
android:name=".SetupWizardApp">
|
||||||
|
|
||||||
<uses-library android:name="org.cyanogenmod.hardware" android:required="false" />
|
|
||||||
|
|
||||||
<meta-data android:name="com.google.android.gms.version"
|
<meta-data android:name="com.google.android.gms.version"
|
||||||
android:value="@integer/google_play_services_version" />
|
android:value="@integer/google_play_services_version" />
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import android.content.SharedPreferences;
|
||||||
import android.content.pm.ThemeUtils;
|
import android.content.pm.ThemeUtils;
|
||||||
import android.content.res.ThemeConfig;
|
import android.content.res.ThemeConfig;
|
||||||
import android.content.res.ThemeManager;
|
import android.content.res.ThemeManager;
|
||||||
|
import android.hardware.CmHardwareManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.preference.PreferenceManager;
|
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.ConnectionResult;
|
||||||
import com.google.android.gms.common.GooglePlayServicesUtil;
|
import com.google.android.gms.common.GooglePlayServicesUtil;
|
||||||
|
|
||||||
import org.cyanogenmod.hardware.KeyDisabler;
|
|
||||||
|
|
||||||
public class CyanogenSettingsPage extends SetupPage {
|
public class CyanogenSettingsPage extends SetupPage {
|
||||||
|
|
||||||
public static final String TAG = "CyanogenSettingsPage";
|
public static final String TAG = "CyanogenSettingsPage";
|
||||||
|
@ -98,7 +97,9 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||||
|
|
||||||
Settings.Secure.putInt(context.getContentResolver(),
|
Settings.Secure.putInt(context.getContentResolver(),
|
||||||
Settings.Secure.DEV_FORCE_SHOW_NAVBAR, enabled ? 1 : 0);
|
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 */
|
/* Save/restore button timeouts to disable them in softkey mode */
|
||||||
SharedPreferences.Editor editor = prefs.edit();
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
|
@ -181,21 +182,16 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean hideKeyDisabler() {
|
private static boolean hideKeyDisabler(Context ctx) {
|
||||||
try {
|
final CmHardwareManager cmHardwareManager =
|
||||||
return !KeyDisabler.isSupported();
|
(CmHardwareManager) ctx.getSystemService(Context.CMHW_SERVICE);
|
||||||
} catch (NoClassDefFoundError e) {
|
return !cmHardwareManager.isSupported(CmHardwareManager.FEATURE_KEY_DISABLE);
|
||||||
// Hardware abstraction framework not installed
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isKeyDisablerActive() {
|
private static boolean isKeyDisablerActive(Context ctx) {
|
||||||
try {
|
final CmHardwareManager cmHardwareManager =
|
||||||
return KeyDisabler.isActive();
|
(CmHardwareManager) ctx.getSystemService(Context.CMHW_SERVICE);
|
||||||
} catch (Exception e) {
|
return cmHardwareManager.get(CmHardwareManager.FEATURE_KEY_DISABLE);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean hideWhisperPush(Context context) {
|
private static boolean hideWhisperPush(Context context) {
|
||||||
|
@ -331,11 +327,11 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||||
needsNavBar = windowManager.needsNavigationBar();
|
needsNavBar = windowManager.needsNavigationBar();
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
}
|
}
|
||||||
if (hideKeyDisabler() || needsNavBar) {
|
if (hideKeyDisabler(getActivity()) || needsNavBar) {
|
||||||
mNavKeysRow.setVisibility(View.GONE);
|
mNavKeysRow.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
boolean navKeysDisabled =
|
boolean navKeysDisabled =
|
||||||
isKeyDisablerActive();
|
isKeyDisablerActive(getActivity());
|
||||||
mNavKeys.setChecked(navKeysDisabled);
|
mNavKeys.setChecked(navKeysDisabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue