Commit 794df6ef authored by Boris Sazonov's avatar Boris Sazonov Committed by Commit Bot

[Unity][Android] Add SigninActivity skeleton

This CL exposes UnifiedConsent feature to Java and adds a skeleton of
SigninActivity, which is created if this feature is enabled. This
activity currently contains an empty container for SigninFragment that
will be added by subsequent CLs.

Bug: 814728
Change-Id: Ic12cfeb7b1fa3732ac625095412473fd12d1781b
Reviewed-on: https://chromium-review.googlesource.com/952971Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Boris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542452}
parent fd291d99
......@@ -522,6 +522,11 @@ by a child template that "extends" this file.
android:theme="@style/DialogWhenLarge"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize">
</activity>
<activity android:name="org.chromium.chrome.browser.signin.SigninActivity"
android:theme="@style/DialogWhenLarge"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize"
android:exported="false">
</activity>
<activity android:name="org.chromium.chrome.browser.preferences.Preferences"
android:theme="@style/PreferencesTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize"
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
......@@ -254,6 +254,7 @@ public abstract class ChromeFeatureList {
public static final String TAB_REPARENTING = "TabReparenting";
public static final String TRUSTED_WEB_ACTIVITY = "TrustedWebActivity";
public static final String VIDEO_PERSISTENCE = "VideoPersistence";
public static final String UNIFIED_CONSENT = "UnifiedConsent";
public static final String VR_BROWSING = "VrBrowsing";
public static final String VR_BROWSING_FEEDBACK = "VrBrowsingFeedback";
public static final String VR_BROWSING_IN_CUSTOM_TAB = "VrBrowsingInCustomTab";
......
......@@ -16,6 +16,7 @@ import org.chromium.base.library_loader.ProcessInitException;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.init.ChromeBrowserInitializer;
import org.chromium.chrome.browser.preferences.ManagedPreferencesUtils;
import org.chromium.chrome.browser.preferences.PrefServiceBridge;
......@@ -67,7 +68,13 @@ public class AccountSigninActivity extends AppCompatActivity
return false;
}
context.startActivity(createIntentForDefaultSigninFlow(context, accessPoint, false));
final Intent intent;
if (ChromeFeatureList.isEnabled(ChromeFeatureList.UNIFIED_CONSENT)) {
intent = SigninActivity.createIntent(context, accessPoint, false);
} else {
intent = createIntentForDefaultSigninFlow(context, accessPoint, false);
}
context.startActivity(intent);
return true;
}
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.signin;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import org.chromium.base.Log;
import org.chromium.base.library_loader.ProcessInitException;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.init.ChromeBrowserInitializer;
/**
* Allows user to pick an account and sign in. Started from Settings and various sign-in promos.
*/
// TODO(https://crbug.com/820491): extend AsyncInitializationActivity.
public class SigninActivity extends AppCompatActivity {
private static final String TAG = "SigninActivity";
/**
* Creates an {@link Intent} which can be used to start the signin flow.
* @param accessPoint {@link AccessPoint} for starting signin flow. Used in metrics.
* @param isFromPersonalizedPromo Whether the signin activity is started from a personalized
* promo.
*/
public static Intent createIntent(Context context,
@AccountSigninActivity.AccessPoint int accessPoint, boolean isFromPersonalizedPromo) {
Intent intent = new Intent(context, SigninActivity.class);
// TODO(https://crbug.com/814728): Call SigninFragment.createArguments.
Bundle fragmentArguments = new Bundle();
intent.putExtras(fragmentArguments);
return intent;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// The browser process must be started here because this activity may be started from the
// recent apps list and it relies on other activities and the native library to be loaded.
try {
ChromeBrowserInitializer.getInstance(this).handleSynchronousStartup();
} catch (ProcessInitException e) {
Log.e(TAG, "Failed to start browser process.", e);
// Since the library failed to initialize nothing in the application
// can work, so kill the whole application not just the activity
System.exit(-1);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.signin_activity);
// TODO(https://crbug.com/814728): Add SigninFragment.
}
}
......@@ -1109,6 +1109,7 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/signin/PersonalizedSigninPromoView.java",
"java/src/org/chromium/chrome/browser/signin/ProfileDataCache.java",
"java/src/org/chromium/chrome/browser/signin/SignOutDialogFragment.java",
"java/src/org/chromium/chrome/browser/signin/SigninActivity.java",
"java/src/org/chromium/chrome/browser/signin/SigninHelper.java",
"java/src/org/chromium/chrome/browser/signin/SigninInvestigator.java",
"java/src/org/chromium/chrome/browser/signin/SigninManager.java",
......
......@@ -53,6 +53,7 @@ const base::Feature* kFeaturesExposedToJava[] = {
&features::kSiteNotificationChannels,
&features::kSimplifiedFullscreenUI,
&features::kSoundContentSetting,
&features::kUnifiedConsent,
&features::kVrBrowsing,
&features::kWebPayments,
&feed::kInterestFeedContentSuggestions,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment