SetupWizard: Conditionally supress d2d on lack of nfc.

If a device lacks NFC feature, pass an extra to googles
  setup wizard to spress the device to device setup.

Change-Id: I05341f14c4a4753cb5a595734eb337eb10d505a4
TICKET: CYNGNOS-2258
This commit is contained in:
Adnan Begovic 2016-03-21 10:20:08 -07:00
parent 7de4615eeb
commit d114a09647
2 changed files with 5 additions and 0 deletions

View File

@ -55,6 +55,7 @@ public class SetupWizardApp extends Application {
public static final String EXTRA_DETAILS = "details"; public static final String EXTRA_DETAILS = "details";
public static final String EXTRA_FRAGMENT = "fragment"; public static final String EXTRA_FRAGMENT = "fragment";
public static final String EXTRA_ACTION_ID = "actionId"; public static final String EXTRA_ACTION_ID = "actionId";
public static final String EXTRA_SUPRESS_D2D_SETUP = "suppress_device_to_device_setup";
public static final String KEY_DETECT_CAPTIVE_PORTAL = "captive_portal_detection_enabled"; public static final String KEY_DETECT_CAPTIVE_PORTAL = "captive_portal_detection_enabled";

View File

@ -27,6 +27,7 @@ import android.app.Fragment;
import android.app.FragmentManager; import android.app.FragmentManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.service.persistentdata.PersistentDataBlockManager; import android.service.persistentdata.PersistentDataBlockManager;
import android.util.Log; import android.util.Log;
@ -220,6 +221,9 @@ public class GmsAccountPage extends SetupPage {
bundle.putBoolean(SetupWizardApp.EXTRA_FIRST_RUN, true); bundle.putBoolean(SetupWizardApp.EXTRA_FIRST_RUN, true);
bundle.putBoolean(SetupWizardApp.EXTRA_ALLOW_SKIP, true); bundle.putBoolean(SetupWizardApp.EXTRA_ALLOW_SKIP, true);
bundle.putBoolean(SetupWizardApp.EXTRA_USE_IMMERSIVE, true); bundle.putBoolean(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
bundle.putBoolean(SetupWizardApp.EXTRA_SUPRESS_D2D_SETUP, !mContext.getPackageManager()
.hasSystemFeature(PackageManager.FEATURE_NFC));
AccountManager AccountManager
.get(mContext).addAccount(SetupWizardApp.ACCOUNT_TYPE_GMS, null, null, .get(mContext).addAccount(SetupWizardApp.ACCOUNT_TYPE_GMS, null, null,
bundle, null, new AccountManagerCallback<Bundle>() { bundle, null, new AccountManagerCallback<Bundle>() {