Compare commits
27 Commits
stable/cm-
...
stable/cm-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92a26a6443 | ||
|
|
42b01535c8 | ||
|
|
7830cd897e | ||
|
|
48d47e29e9 | ||
|
|
f55f150988 | ||
|
|
c0328ee2ba | ||
|
|
028b34a4ec | ||
|
|
e6d824f6ef | ||
|
|
0a7e22ff17 | ||
|
|
cbb99cc563 | ||
|
|
e097ca87a6 | ||
|
|
7a2d51c5e2 | ||
|
|
c3723495bf | ||
|
|
21b7055507 | ||
|
|
6fc8aa4a75 | ||
|
|
01552b9e52 | ||
|
|
41cbad4e5b | ||
|
|
e499b32d70 | ||
|
|
bdfe88d06b | ||
|
|
1540532700 | ||
|
|
c756a8c22b | ||
|
|
d84b71f941 | ||
|
|
22e251dc86 | ||
|
|
22d81f407a | ||
|
|
3e845be8c4 | ||
|
|
b72a776fff | ||
|
|
07e2d37258 |
@@ -17,6 +17,8 @@ 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
|
||||
|
||||
@@ -66,9 +66,10 @@
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@style/Theme.Setup"
|
||||
android:uiOptions="none"
|
||||
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" />
|
||||
|
||||
@@ -76,9 +77,9 @@
|
||||
android:label="@string/product_name"
|
||||
android:launchMode="singleInstance"
|
||||
android:excludeFromRecents="true"
|
||||
android:uiOptions="none"
|
||||
android:configChanges="themeChange|mcc|mnc"
|
||||
android:immersive="true"
|
||||
android:windowSoftInputMode="stateAlwaysHidden">
|
||||
android:immersive="true">
|
||||
|
||||
<intent-filter android:priority="9">
|
||||
|
||||
|
||||
@@ -20,4 +20,5 @@
|
||||
<!-- The type of sim image to display.
|
||||
0=default sim image, 1=sim on side, 2=sim on back-->
|
||||
<integer name="sim_image_type">0</integer>
|
||||
<bool name="check_custom_theme_by_default">true</bool>
|
||||
</resources>
|
||||
|
||||
@@ -34,8 +34,6 @@ public abstract class AbstractSetupData extends BroadcastReceiver implements Set
|
||||
|
||||
private boolean mIsResumed = false;
|
||||
|
||||
private boolean mIsFinished = false;
|
||||
|
||||
private OnResumeRunnable mOnResumeRunnable;
|
||||
|
||||
public AbstractSetupData(Context context) {
|
||||
@@ -188,7 +186,6 @@ public abstract class AbstractSetupData extends BroadcastReceiver implements Set
|
||||
}
|
||||
|
||||
public void finishPages() {
|
||||
mIsFinished = true;
|
||||
for (Page page : mPageList.values()) {
|
||||
page.onFinishSetup();
|
||||
}
|
||||
@@ -201,10 +198,6 @@ public abstract class AbstractSetupData extends BroadcastReceiver implements Set
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFinished() {
|
||||
return mIsFinished;
|
||||
}
|
||||
|
||||
public Bundle save() {
|
||||
Bundle bundle = new Bundle();
|
||||
for (Page page : mPageList.values()) {
|
||||
|
||||
@@ -20,10 +20,11 @@ import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
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;
|
||||
@@ -51,6 +52,8 @@ 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";
|
||||
@@ -63,6 +66,8 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||
public static final String SETTING_METRICS = "settings.cyanogen.allow_metrics";
|
||||
public static final String PRIVACY_POLICY_URI = "https://cyngn.com/oobe-legal?hideHeader=1";
|
||||
|
||||
private static final String WHISPERPUSH_PACKAGE = "org.whispersystems.whisperpush";
|
||||
|
||||
public CyanogenSettingsPage(Context context, SetupDataCallbacks callbacks) {
|
||||
super(context, callbacks);
|
||||
}
|
||||
@@ -97,9 +102,7 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||
|
||||
Settings.Secure.putInt(context.getContentResolver(),
|
||||
Settings.Secure.DEV_FORCE_SHOW_NAVBAR, enabled ? 1 : 0);
|
||||
final CmHardwareManager cmHardwareManager =
|
||||
(CmHardwareManager) context.getSystemService(Context.CMHW_SERVICE);
|
||||
cmHardwareManager.set(CmHardwareManager.FEATURE_KEY_DISABLE, enabled);
|
||||
KeyDisabler.setActive(enabled);
|
||||
|
||||
/* Save/restore button timeouts to disable them in softkey mode */
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
@@ -182,21 +185,34 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||
}
|
||||
}
|
||||
|
||||
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 hideKeyDisabler() {
|
||||
try {
|
||||
return !KeyDisabler.isSupported();
|
||||
} catch (NoClassDefFoundError e) {
|
||||
// Hardware abstraction framework not installed
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
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 isKeyDisablerActive() {
|
||||
try {
|
||||
return KeyDisabler.isActive();
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean hideWhisperPush(Context context) {
|
||||
final int playServicesAvailable = GooglePlayServicesUtil
|
||||
.isGooglePlayServicesAvailable(context);
|
||||
try {
|
||||
PackageInfo pi = context.getPackageManager().getPackageInfo(WHISPERPUSH_PACKAGE, 0);
|
||||
if (pi == null) {
|
||||
return true;
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return true;
|
||||
}
|
||||
return playServicesAvailable != ConnectionResult.SUCCESS
|
||||
|| !SetupWizardUtils.hasTelephony(context)
|
||||
|| (SetupWizardUtils.hasTelephony(context) &&
|
||||
@@ -321,12 +337,12 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||
needsNavBar = windowManager.needsNavigationBar();
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
mHideNavKeysRow = hideKeyDisabler(getActivity());
|
||||
mHideNavKeysRow = hideKeyDisabler();
|
||||
if (mHideNavKeysRow || needsNavBar) {
|
||||
mNavKeysRow.setVisibility(View.GONE);
|
||||
} else {
|
||||
boolean navKeysDisabled =
|
||||
isKeyDisablerActive(getActivity());
|
||||
isKeyDisablerActive();
|
||||
mNavKeys.setChecked(navKeysDisabled);
|
||||
}
|
||||
|
||||
@@ -374,9 +390,13 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||
private void updateThemeOption() {
|
||||
if (!mHideThemeRow) {
|
||||
final Bundle myPageBundle = mPage.getData();
|
||||
boolean themesChecked =
|
||||
!myPageBundle.containsKey(KEY_APPLY_DEFAULT_THEME) || myPageBundle
|
||||
.getBoolean(KEY_APPLY_DEFAULT_THEME);
|
||||
boolean themesChecked;
|
||||
if (myPageBundle.containsKey(KEY_APPLY_DEFAULT_THEME)) {
|
||||
themesChecked = myPageBundle.getBoolean(KEY_APPLY_DEFAULT_THEME);
|
||||
} else {
|
||||
themesChecked = getActivity().getResources().getBoolean(
|
||||
R.bool.check_custom_theme_by_default);
|
||||
}
|
||||
mDefaultTheme.setChecked(themesChecked);
|
||||
myPageBundle.putBoolean(KEY_APPLY_DEFAULT_THEME, themesChecked);
|
||||
}
|
||||
|
||||
@@ -176,33 +176,31 @@ public class GmsAccountPage extends SetupPage {
|
||||
private void launchGmsRestorePage() {
|
||||
try {
|
||||
// GMS can disable this after logging in sometimes
|
||||
if (SetupWizardUtils.enableGMSSetupWizard(mContext)) {
|
||||
Intent intent = new Intent(ACTION_RESTORE);
|
||||
intent.putExtra(SetupWizardApp.EXTRA_ALLOW_SKIP, true);
|
||||
intent.putExtra(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
|
||||
intent.putExtra(SetupWizardApp.EXTRA_FIRST_RUN, true);
|
||||
intent.putExtra(SetupWizardApp.EXTRA_THEME, SetupWizardApp.EXTRA_MATERIAL_LIGHT);
|
||||
// XXX: Fool G's setup wizard into thinking it is their setup wizard.
|
||||
// This is necessary to get the material theme on the restore page.
|
||||
intent.putExtra("scriptUri", RESTORE_WIZARD_SCRIPT);
|
||||
ActivityOptions options =
|
||||
ActivityOptions.makeCustomAnimation(mContext,
|
||||
android.R.anim.fade_in,
|
||||
android.R.anim.fade_out);
|
||||
SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
|
||||
SetupStats.Action.EXTERNAL_PAGE_LAUNCH,
|
||||
SetupStats.Label.PAGE, SetupStats.Label.RESTORE);
|
||||
mFragment.startActivityForResult(
|
||||
intent,
|
||||
SetupWizardApp.REQUEST_CODE_RESTORE_GMS, options.toBundle());
|
||||
return;
|
||||
}
|
||||
SetupWizardUtils.enableGMSSetupWizard(mContext);
|
||||
Intent intent = new Intent(ACTION_RESTORE);
|
||||
intent.putExtra(SetupWizardApp.EXTRA_ALLOW_SKIP, true);
|
||||
intent.putExtra(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
|
||||
intent.putExtra(SetupWizardApp.EXTRA_FIRST_RUN, true);
|
||||
intent.putExtra(SetupWizardApp.EXTRA_THEME, SetupWizardApp.EXTRA_MATERIAL_LIGHT);
|
||||
// XXX: Fool G's setup wizard into thinking it is their setup wizard.
|
||||
// This is necessary to get the material theme on the restore page.
|
||||
intent.putExtra("scriptUri", RESTORE_WIZARD_SCRIPT);
|
||||
ActivityOptions options =
|
||||
ActivityOptions.makeCustomAnimation(mContext,
|
||||
android.R.anim.fade_in,
|
||||
android.R.anim.fade_out);
|
||||
SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
|
||||
SetupStats.Action.EXTERNAL_PAGE_LAUNCH,
|
||||
SetupStats.Label.PAGE, SetupStats.Label.RESTORE);
|
||||
mFragment.startActivityForResult(
|
||||
intent,
|
||||
SetupWizardApp.REQUEST_CODE_RESTORE_GMS, options.toBundle());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
// XXX: In open source, we don't know what gms version a user has.
|
||||
// Bail if the restore activity is not found.
|
||||
getCallbacks().onNextPage();
|
||||
}
|
||||
getCallbacks().onNextPage();
|
||||
}
|
||||
|
||||
private void launchGmsAccountSetup() {
|
||||
|
||||
@@ -270,10 +270,6 @@ public class OtherSettingsPage extends SetupPage {
|
||||
SetupStats.Action.ENABLE_NETWORK_LOCATION,
|
||||
SetupStats.Label.CHECKED, String.valueOf(networkEnabled));
|
||||
mLocationAccess.setChecked(gpsEnabled || networkEnabled);
|
||||
mGps.setEnabled(gpsEnabled || networkEnabled);
|
||||
mGpsRow.setEnabled(gpsEnabled || networkEnabled);
|
||||
mNetwork.setEnabled(gpsEnabled || networkEnabled);
|
||||
mNetworkRow.setEnabled(gpsEnabled || networkEnabled);
|
||||
}
|
||||
|
||||
private void onToggleLocationAccess(boolean checked) {
|
||||
|
||||
@@ -56,12 +56,6 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
||||
|
||||
private static final String TAG = SetupWizardActivity.class.getSimpleName();
|
||||
|
||||
private static final int UI_FLAGS = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
|
||||
private View mRootView;
|
||||
private View mButtonBar;
|
||||
private Button mNextButton;
|
||||
@@ -83,25 +77,12 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
||||
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
final View decorView = getWindow().getDecorView();
|
||||
decorView.setSystemUiVisibility(UI_FLAGS);
|
||||
decorView.setOnSystemUiVisibilityChangeListener(
|
||||
new View.OnSystemUiVisibilityChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onSystemUiVisibilityChange(int visibility) {
|
||||
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
|
||||
decorView.setSystemUiVisibility(UI_FLAGS);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (sLaunchTime == 0) {
|
||||
SetupStats.addEvent(SetupStats.Categories.APP_LAUNCH, TAG);
|
||||
sLaunchTime = System.nanoTime();
|
||||
}
|
||||
setContentView(R.layout.setup_main);
|
||||
mRootView = findViewById(R.id.root);
|
||||
mRootView.setSystemUiVisibility(UI_FLAGS);
|
||||
mReveal = (ImageView)mRootView.findViewById(R.id.reveal);
|
||||
mButtonBar = findViewById(R.id.button_bar);
|
||||
mFinishingProgressBar = (ProgressBar)findViewById(R.id.finishing_bar);
|
||||
@@ -112,10 +93,6 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
||||
}
|
||||
mNextButton = (Button) findViewById(R.id.next_button);
|
||||
mPrevButton = (Button) findViewById(R.id.prev_button);
|
||||
if (mSetupData.isFinished()) {
|
||||
mNextButton.setVisibility(View.INVISIBLE);
|
||||
mPrevButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
mSetupData.registerListener(this);
|
||||
mNextButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -143,9 +120,7 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
||||
mRootView.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
return
|
||||
mEnableAccessibilityController.onInterceptTouchEvent(event) &
|
||||
mEnableAccessibilityController.onTouchEvent(event);
|
||||
return mEnableAccessibilityController.onInterceptTouchEvent(event);
|
||||
}
|
||||
});
|
||||
registerReceiver(mSetupData, mSetupData.getIntentFilter());
|
||||
@@ -153,21 +128,14 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
final View decorView = getWindow().getDecorView();
|
||||
decorView.setSystemUiVisibility(UI_FLAGS);
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
||||
super.onResume();
|
||||
if (mSetupData.isFinished()) {
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
finishSetup();
|
||||
}
|
||||
}, 500);
|
||||
} else {
|
||||
mSetupData.onResume();
|
||||
onPageTreeChanged();
|
||||
enableButtonBar(true);
|
||||
}
|
||||
mSetupData.onResume();
|
||||
onPageTreeChanged();
|
||||
enableButtonBar(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -308,18 +276,17 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
||||
final ThemeManager tm = (ThemeManager) getSystemService(Context.THEME_SERVICE);
|
||||
tm.addClient(this);
|
||||
mSetupData.finishPages();
|
||||
SetupStats.addEvent(SetupStats.Categories.APP_FINISHED, TAG,
|
||||
SetupStats.Label.TOTAL_TIME, String.valueOf(
|
||||
System.nanoTime() - sLaunchTime));
|
||||
setupWizardApp.sendStickyBroadcastAsUser(
|
||||
new Intent(SetupWizardApp.ACTION_FINISHED),
|
||||
UserHandle.getCallingUserHandle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish(boolean isSuccess) {
|
||||
if (isResumed()) {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
finishSetup();
|
||||
}
|
||||
});
|
||||
}
|
||||
finishSetup();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -333,13 +300,6 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
||||
@Override
|
||||
public void finishSetup() {
|
||||
if (!mIsFinishing) {
|
||||
SetupStats.addEvent(SetupStats.Categories.APP_FINISHED, TAG,
|
||||
SetupStats.Label.TOTAL_TIME, String.valueOf(
|
||||
System.nanoTime() - sLaunchTime));
|
||||
final SetupWizardApp setupWizardApp = (SetupWizardApp)getApplication();
|
||||
setupWizardApp.sendStickyBroadcastAsUser(
|
||||
new Intent(SetupWizardApp.ACTION_FINISHED),
|
||||
UserHandle.getCallingUserHandle());
|
||||
mIsFinishing = true;
|
||||
setupRevealImage();
|
||||
}
|
||||
@@ -434,10 +394,10 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
||||
wallpaperManager.forgetLoadedWallpaper();
|
||||
}
|
||||
});
|
||||
finish();
|
||||
for (Runnable runnable : mFinishRunnables) {
|
||||
runnable.run();
|
||||
}
|
||||
finish();
|
||||
SetupWizardUtils.disableSetupWizard(SetupWizardActivity.this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ import java.util.List;
|
||||
|
||||
public class EnableAccessibilityController {
|
||||
|
||||
private static final int SPEAK_WARNING_DELAY_MILLIS = 2000;
|
||||
private static final int ENABLE_ACCESSIBILITY_DELAY_MILLIS = 6000;
|
||||
private static final int SPEAK_WARNING_DELAY_MILLIS = 5000;
|
||||
private static final int ENABLE_ACCESSIBILITY_DELAY_MILLIS = 12000;
|
||||
|
||||
public static final int MESSAGE_SPEAK_WARNING = 1;
|
||||
public static final int MESSAGE_SPEAK_ENABLE_CANCELED = 2;
|
||||
@@ -91,7 +91,6 @@ public class EnableAccessibilityController {
|
||||
private final float mTouchSlop;
|
||||
|
||||
private boolean mDestroyed;
|
||||
private boolean mCanceled;
|
||||
|
||||
private float mFirstPointerDownX;
|
||||
private float mFirstPointerDownY;
|
||||
@@ -130,7 +129,7 @@ public class EnableAccessibilityController {
|
||||
// accessibility service, then we have nothing to do.
|
||||
if (accessibilityManager.isEnabled()
|
||||
&& !accessibilityManager.getEnabledAccessibilityServiceList(
|
||||
AccessibilityServiceInfo.FEEDBACK_SPOKEN).isEmpty()) {
|
||||
AccessibilityServiceInfo.FEEDBACK_SPOKEN).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -168,7 +167,7 @@ public class EnableAccessibilityController {
|
||||
mHandler.sendEmptyMessageDelayed(MESSAGE_SPEAK_WARNING,
|
||||
SPEAK_WARNING_DELAY_MILLIS);
|
||||
mHandler.sendEmptyMessageDelayed(MESSAGE_ENABLE_ACCESSIBILITY,
|
||||
ENABLE_ACCESSIBILITY_DELAY_MILLIS);
|
||||
ENABLE_ACCESSIBILITY_DELAY_MILLIS);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -177,25 +176,13 @@ public class EnableAccessibilityController {
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
final int pointerCount = event.getPointerCount();
|
||||
final int action = event.getActionMasked();
|
||||
if (mCanceled) {
|
||||
if (action == MotionEvent.ACTION_UP) {
|
||||
mCanceled = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_POINTER_DOWN: {
|
||||
if (pointerCount > 2) {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
case MotionEvent.ACTION_MOVE: {
|
||||
//We only care about a 2 fingered move
|
||||
if (pointerCount < 2) {
|
||||
cancel();
|
||||
return false;
|
||||
}
|
||||
final float firstPointerMove = MathUtils.dist(event.getX(0),
|
||||
event.getY(0), mFirstPointerDownX, mFirstPointerDownY);
|
||||
if (Math.abs(firstPointerMove) > mTouchSlop) {
|
||||
@@ -206,19 +193,16 @@ public class EnableAccessibilityController {
|
||||
if (Math.abs(secondPointerMove) > mTouchSlop) {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
case MotionEvent.ACTION_POINTER_UP:
|
||||
case MotionEvent.ACTION_CANCEL: {
|
||||
cancel();
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void cancel() {
|
||||
mCanceled = true;
|
||||
if (mHandler.hasMessages(MESSAGE_SPEAK_WARNING)) {
|
||||
mHandler.removeMessages(MESSAGE_SPEAK_WARNING);
|
||||
} else if (mHandler.hasMessages(MESSAGE_ENABLE_ACCESSIBILITY)) {
|
||||
|
||||
@@ -174,7 +174,7 @@ public class SetupWizardUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean enableGMSSetupWizard(Context context) {
|
||||
public static void enableGMSSetupWizard(Context context) {
|
||||
try {
|
||||
PackageInfo packageInfo = context.getPackageManager()
|
||||
.getPackageInfo(GOOGLE_SETUPWIZARD_PACKAGE,
|
||||
@@ -183,10 +183,8 @@ public class SetupWizardUtils {
|
||||
enableComponentArray(context, packageInfo.activities);
|
||||
enableComponentArray(context, packageInfo.services);
|
||||
enableComponentArray(context, packageInfo.receivers);
|
||||
return true;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(TAG, "Unable to enable GMS");
|
||||
return false;
|
||||
Log.e(TAG, "Unable to disable GMS");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user