Compare commits

..

27 Commits

Author SHA1 Message Date
emancebo
92a26a6443 SetupWizard: add overlay to uncheck cyanogen theme option by default
Change-Id: I278dcb3b2d8099b71a66d90250c40836dd8ec7fc
(cherry picked from commit 7a255f6e5c)
2015-05-23 01:55:49 +00:00
Michael Bestas
42b01535c8 Automatic translation import
Change-Id: I6b8d3fb084df5abb3449b842ce02d1d6aaf2170a
2015-05-23 00:01:00 +00:00
Michael Bestas
7830cd897e Automatic translation import
Change-Id: Ifc62c159189df11f3443defc57069ab5b78b644f
2015-05-23 00:00:50 +00:00
Michael Bestas
48d47e29e9 Automatic translation import
Change-Id: I1649ba39d39b73ce351909a310041d6f6b0a99b7
2015-05-23 00:00:35 +00:00
Michael Bestas
f55f150988 Automatic translation import
Change-Id: Ifa97d2292f1ab37a21a8695a53e673f406df706b
2015-05-22 23:59:59 +00:00
Michael Bestas
c0328ee2ba Automatic translation import
Change-Id: Icd2308a33556872fa1564058b8250c60dc1b8372
2015-05-22 23:59:34 +00:00
Michael Bestas
028b34a4ec Automatic translation import
Change-Id: I9aa0c0cf342d79ffcdb42e8c87284ad354fc9563
2015-05-22 23:58:49 +00:00
Michael Bestas
e6d824f6ef Automatic translation import
Change-Id: If0a158896a3ec49fb0b32c48c6f426dea4d9b653
2015-05-22 23:56:05 +00:00
Michael Bestas
0a7e22ff17 Automatic translation import
Change-Id: Ie14f953a377b6d9410c6b5b386334e153abd4964
2015-05-22 23:47:04 +00:00
d34d
cbb99cc563 Remove use of mCanceled
It is possible for mCanceled to be set to true even though it
was canceled without ever playing back the cancelation message.
This can end up putting us in an incorrect state where the user
must release both fingers so ACTION_UP finally sets mCanceled to
false.

The cancel() method was still being called and since it does the
proper checks for removing/sending messages, the use of mCanceled
is unneccessary.

Change-Id: I38679d3bf65157a9ba5ca3d898c5c8d55e5df9f5
REF: LETTUCE-293
2015-05-19 22:09:06 +00:00
Roman Birg
e097ca87a6 SetupWizard: hide WhisperPush if it's not installed
Change-Id: I7576a2ee0f851e1222b6ed4d53188950b20b6a16
Signed-off-by: Roman Birg <roman@cyngn.com>
(cherry picked from commit bfd3abd0c7)
2015-05-15 16:51:47 +00:00
cretin45
7a2d51c5e2 SetupWizard: Increase delay for accessibility
Change-Id: Ifff7161f95e91ec7763f388206cd1d30804ad600
(cherry picked from commit 9dd952e3f6)
2015-05-09 04:26:54 +00:00
cretin45
c3723495bf Setupwizard: Fix msim NPE where sim only in slot 2
Change-Id: I919129185cb49c51f9f02d9718e116e7d02b0d2c
(cherry picked from commit a0eb5bb442)
2015-04-28 17:12:22 +00:00
cretin45
21b7055507 SetupWizard: Give radio a 10 second chance to come up
Change-Id: Iadd817b200106783dd67edbc5ad03928ce2baa6b
2015-04-14 17:35:25 -07:00
cretin45
6fc8aa4a75 SetupWizard: Don't assume order of SubInfoRecords
Change-Id: I3b4132afccc96a5d08986a3cb902bd384931f21f
2015-04-14 17:35:13 -07:00
cretin45
01552b9e52 SetupWizard: Ensure page object isn't null if FM destroyed
Change-Id: Ia794e7656587ca803d02418d3d84d4df5027cd00
(cherry picked from commit 62b79e3880)
2015-04-10 23:38:02 +00:00
cretin45
41cbad4e5b SetupWizard: Lock orientation prior to finish animation
Change-Id: I43a69937e2deb5f55585522fe5d00c51ffdae569
(cherry picked from commit c8e4c29020)
2015-03-23 22:10:39 +00:00
cretin45
e499b32d70 SetupWizard: Initialize the nav keys bundle boolean
Change-Id: I50f2ef0fb7226c8b58437b669ca71df436d68ee8
2015-03-20 15:07:35 -07:00
cretin45
bdfe88d06b SetupWizard: Fix regression for devices without custom default theme
Change-Id: Ia223c1b118dbb68e596ff01cf944bc870a321752
2015-03-20 15:06:44 -07:00
cretin45
1540532700 SetupWizard: Fix regression, only init pages once
Change-Id: I1207cb3975daa752a66eb8e9e40635f9a8009509
(cherry picked from commit 83be05d6ec)
2015-03-19 17:50:29 +00:00
d34d
c756a8c22b Disable theme components for secondary users
This patch is to mitigate theming problems with multiple users.
Once themes properly support multiple users we can revert this.

Change-Id: Iff50571adfabb97b10c3c3257cf9fb2d8e5b0d79
2015-03-18 10:16:54 -07:00
cretin45
d84b71f941 SetupWizard: Only go through OOBE if owner
Change-Id: I3886119d0d6fd69f18ea23d4b6435da75280dbf8
(cherry picked from commit 0ed67f547c)
2015-03-18 17:13:32 +00:00
cretin45
22e251dc86 SetupWizard: Better handling of launching into other activities
Change-Id: I4d8dc4a1b25e45c6ff35042239a0adf4c16458f1
(cherry picked from commit ed5d46703e)
2015-03-17 22:20:53 +00:00
cretin45
22d81f407a SetupWizard: Refactor for better transitions out of OOBE
Change-Id: If91da3f44dbc5383236b54da529953d48a475250
(cherry picked from commit 0d31b31aac)
2015-03-16 22:30:37 +00:00
cretin45
3e845be8c4 SetupWizard: Only update network state when resumed
Change-Id: Id018bf0ed4d9c54a1d6d57d53749c265b1d0e269
(cherry picked from commit f66c56b62f)
2015-03-12 00:16:09 +00:00
cretin45
b72a776fff SetupWizard: Update legal link
Change-Id: I1389dbb3e7e0ba3b7db992fdef02f4c8fdc1692d
(cherry picked from commit 77fce341b1)
2015-03-11 17:01:13 +00:00
cretin45
07e2d37258 SetupWizard: Fix race condition on finish
Change-Id: Ie4a5893c49db7ce9622091e05776cb5523ed5c45
(cherry picked from commit 7c8e091320)
2015-03-06 22:03:14 +00:00
10 changed files with 89 additions and 136 deletions

View File

@@ -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

View File

@@ -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">

View File

@@ -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>

View File

@@ -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()) {

View File

@@ -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);
}

View File

@@ -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() {

View File

@@ -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) {

View File

@@ -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);
}
}

View File

@@ -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)) {

View File

@@ -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");
}
}