forked from uazo/cromite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWelcome-screen.patch
1307 lines (1276 loc) · 62.9 KB
/
Welcome-screen.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
From: csagan5 <[email protected]>
Date: Fri, 29 Apr 2022 00:31:49 +0200
Subject: Welcome screen
Allow toggling automatic updates
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
chrome/android/chrome_java_resources.gni | 1 +
chrome/android/chrome_java_sources.gni | 2 +
.../android/java/res/layout/fre_tosanduma.xml | 160 +++++++++
chrome/android/java/res/values/dimens.xml | 10 +
chrome/android/java/res/values/styles.xml | 24 ++
.../firstrun/ChildAccountStatusSupplier.java | 13 -
.../DefaultSearchEngineFirstRunFragment.java | 3 -
.../browser/firstrun/FirstRunActivity.java | 25 +-
.../firstrun/FirstRunActivityBase.java | 6 +-
.../firstrun/FirstRunFlowSequencer.java | 61 +---
.../browser/firstrun/FirstRunUtils.java | 15 +-
.../firstrun/ToSAndUMAFirstRunFragment.java | 335 +++++++++++++++++
.../firstrun/TosAndUmaFragmentView.java | 336 ++++++++++++++++++
.../browser/locale/LocaleManagerDelegate.java | 5 +-
.../strings/android_chrome_strings.grd | 24 +-
15 files changed, 913 insertions(+), 107 deletions(-)
create mode 100644 chrome/android/java/res/layout/fre_tosanduma.xml
create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java
create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/firstrun/TosAndUmaFragmentView.java
diff --git a/chrome/android/chrome_java_resources.gni b/chrome/android/chrome_java_resources.gni
--- a/chrome/android/chrome_java_resources.gni
+++ b/chrome/android/chrome_java_resources.gni
@@ -506,6 +506,7 @@ chrome_java_resources = [
"java/res/layout/find_in_page.xml",
"java/res/layout/find_toolbar.xml",
"java/res/layout/fre_tos_privacy_disclaimer.xml",
+ "java/res/layout/fre_tosanduma.xml",
"java/res/layout/history_clear_browsing_data_header.xml",
"java/res/layout/history_item_view.xml",
"java/res/layout/history_main.xml",
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni
--- a/chrome/android/chrome_java_sources.gni
+++ b/chrome/android/chrome_java_sources.gni
@@ -654,6 +654,8 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/firstrun/SyncConsentFirstRunFragment.java",
"java/src/org/chromium/chrome/browser/firstrun/TabbedModeFirstRunActivity.java",
"java/src/org/chromium/chrome/browser/firstrun/TosDialogBehaviorSharedPrefInvalidator.java",
+ "java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java",
+ "java/src/org/chromium/chrome/browser/firstrun/TosAndUmaFragmentView.java",
"java/src/org/chromium/chrome/browser/flags/BadFlagsSnackbarManager.java",
"java/src/org/chromium/chrome/browser/fonts/FontPreloader.java",
"java/src/org/chromium/chrome/browser/fullscreen/BrowserControlsManager.java",
diff --git a/chrome/android/java/res/layout/fre_tosanduma.xml b/chrome/android/java/res/layout/fre_tosanduma.xml
new file mode 100644
--- /dev/null
+++ b/chrome/android/java/res/layout/fre_tosanduma.xml
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright 2015 The Chromium Authors
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+-->
+<!-- Most of the placement in this layout is controlled by TosAndUmaFragmentView#onMeasure. When changing the layout in this file, be sure to also check on the view object to see what is changing to avoid unexpected behavior. -->
+<org.chromium.chrome.browser.firstrun.TosAndUmaFragmentView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <ScrollView
+ android:id="@+id/scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_above="@id/fre_bottom_group"
+ android:fillViewport="true">
+
+ <!-- The orientation of this view is changed dynamically to give a nicer layout when in
+ landscape mode on devices with small screens. -->
+ <LinearLayout
+ android:id="@+id/fre_main_layout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:animateLayoutChanges="true"
+ android:gravity="center_horizontal">
+
+ <ImageView
+ android:id="@+id/image"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/fre_tos_image_height"
+ android:layout_marginHorizontal="@dimen/fre_vertical_spacing"
+ android:layout_marginBottom="@dimen/fre_image_bottom_margin"
+ android:importantForAccessibility="no"
+ android:src="@drawable/fre_product_logo" />
+
+ <LinearLayout
+ android:id="@+id/fre_title_and_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/title"
+ android:text="@string/fre_welcome"
+ style="@style/FreWelcomePageTitle" />
+
+ <!-- The FrameLayout here is to facilitate adding a proper content description for
+ the loading view. During development, it didn't seem possible to override the
+ LoadingView contentDescription in XML, but if there's support for this at some
+ point then we can remove the FrameLayout. -->
+ <FrameLayout
+ android:id="@+id/loading_view_container"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:visibility="gone"
+ android:contentDescription="@string/sync_loading">
+
+ <org.chromium.ui.widget.LoadingView
+ android:id="@+id/progress_spinner_large"
+ style="@style/Widget.AppCompat.ProgressBar"
+ android:layout_height="@dimen/fre_loading_spinner_size"
+ android:layout_width="@dimen/fre_loading_spinner_size"
+ android:visibility="gone"/>
+
+ </FrameLayout>
+
+ <LinearLayout
+ android:id="@+id/fre_content_wrapper"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:layout_marginEnd="@dimen/fre_content_margin"
+ android:gravity="center_vertical"
+ android:orientation="vertical" >
+
+ <org.chromium.ui.widget.TextViewWithClickableSpans
+ android:id="@+id/tos_and_privacy"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/fre_vertical_spacing"
+ android:layout_marginBottom="@dimen/fre_tos_bottom_margin"
+ android:lineSpacingMultiplier="1.4"
+ android:textAppearance="@style/TextAppearance.TextMedium.Primary" />
+
+ <CheckBox
+ android:id="@+id/auto_updater_checkbox"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:lineSpacingMultiplier="1.4"
+ android:text="@string/auto_updater_check"
+ android:paddingStart="@dimen/fre_tos_checkbox_padding"
+ android:textAppearance="@style/TextAppearance.TextMedium.Primary" />
+ </LinearLayout>
+
+ <include
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_marginEnd="@dimen/fre_content_margin"
+ android:layout_marginTop="@dimen/fre_policy_privacy_disclaimer_top_margin"
+ android:layout_marginBottom="@dimen/fre_vertical_spacing"
+ android:visibility="gone"
+ layout="@layout/fre_tos_privacy_disclaimer" />
+ </LinearLayout>
+ </LinearLayout>
+ </ScrollView>
+
+ <FrameLayout
+ android:id="@+id/fre_bottom_group"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_marginVertical="@dimen/fre_button_vertical_margin"
+ android:layout_marginHorizontal="@dimen/fre_content_margin">
+
+ <org.chromium.ui.widget.ButtonCompat
+ android:id="@+id/terms_accept"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:text="@string/fre_accept_continue"
+ android:animateLayoutChanges="true"
+ style="@style/FreAcceptTosButton" />
+
+ <!-- Same location as the button; marginBottom is adjusted for the different size. -->
+ <ProgressBar
+ android:id="@+id/progress_spinner"
+ style="@style/Widget.AppCompat.ProgressBar"
+ android:layout_gravity="center"
+ android:layout_width="@dimen/fre_bottom_loading_spinner_size"
+ android:layout_height="@dimen/fre_bottom_loading_spinner_size"/>
+ </FrameLayout>
+
+ <ImageView
+ android:id="@+id/shadow"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/action_bar_shadow_height"
+ android:layout_gravity="bottom"
+ android:layout_above="@id/fre_bottom_group"
+ android:background="@drawable/modern_toolbar_shadow"
+ android:scaleY="-1"
+ android:visibility="gone"
+ android:importantForAccessibility="no" />
+
+ <!-- Empty TextView to preload fonts for following pages. See https://crbug.com/1119990#c20 -->
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="@style/TextAppearance.Headline.Primary"
+ android:visibility="gone"/>
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="@style/TextAppearance.Button.Text.Filled"
+ android:visibility="gone"/>
+
+</org.chromium.chrome.browser.firstrun.TosAndUmaFragmentView>
diff --git a/chrome/android/java/res/values/dimens.xml b/chrome/android/java/res/values/dimens.xml
--- a/chrome/android/java/res/values/dimens.xml
+++ b/chrome/android/java/res/values/dimens.xml
@@ -110,6 +110,16 @@ found in the LICENSE file.
<dimen name="fre_loading_spinner_size">48dp</dimen>
<dimen name="fre_policy_privacy_disclaimer_icon_size">18dp</dimen>
<dimen name="fre_policy_privacy_disclaimer_icon_padding">8dp</dimen>
+ <dimen name="fre_image_bottom_margin">36dp</dimen>
+ <dimen name="fre_vertical_spacing">32dp</dimen>
+ <dimen name="fre_content_margin">24dp</dimen>
+ <dimen name="fre_tos_bottom_margin">16dp</dimen>
+ <dimen name="fre_tos_checkbox_padding">12dp</dimen>
+ <dimen name="fre_bottom_loading_spinner_size">24dp</dimen>
+ <dimen name="fre_policy_privacy_disclaimer_top_margin">16dp</dimen>
+ <dimen name="fre_button_vertical_margin">24dp</dimen>
+ <dimen name="fre_landscape_top_padding">72dp</dimen>
+ <dimen name="fre_button_vertical_margin_small">16dp</dimen>
<!-- Account Signin dimensions -->
<!-- The Account Signin page appears in the First Run Experience (amongst other places), so uses
diff --git a/chrome/android/java/res/values/styles.xml b/chrome/android/java/res/values/styles.xml
--- a/chrome/android/java/res/values/styles.xml
+++ b/chrome/android/java/res/values/styles.xml
@@ -270,6 +270,30 @@ found in the LICENSE file.
<item name="android:layout_weight">1</item>
</style>
+ <!-- First Run Experience -->
+ <!-- Avoid using @font/accent_font, a downloaded font, on text that could appear in the first
+ couple of frames of app start. It may not be ready yet, see https://crbug.com/1119990 -->
+ <style name="TextAppearance.FreFirstFrameTitle" parent="TextAppearance.Headline.Primary" >
+ <item name="android:fontFamily">sans-serif</item>
+ </style>
+ <!-- Match the fontFamily in ui/android/java/res/values/styles.xml -->
+ <style name="TextAppearance.FreFirstFrameButton" parent="TextAppearance.Button.Text.Filled">
+ <item name="android:fontFamily">sans-serif-medium</item>
+ </style>
+ <style name="FreTitle">
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:gravity">center</item>
+ <item name="android:lineSpacingMultiplier">1.4</item>
+ <item name="android:textAppearance">@style/TextAppearance.Headline.Primary</item>
+ </style>
+ <style name="FreWelcomePageTitle" parent="FreTitle">
+ <item name="android:textAppearance">@style/TextAppearance.FreFirstFrameTitle</item>
+ </style>
+ <style name="FreAcceptTosButton" parent="FilledButton.Flat">
+ <item name="android:textAppearance">@style/TextAppearance.FreFirstFrameButton</item>
+ </style>
+
<!-- Generic Overlay Panel styles -->
<style name="OverlayPanelTextViewLayout">
<item name="android:layout_width">match_parent</item>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ChildAccountStatusSupplier.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ChildAccountStatusSupplier.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ChildAccountStatusSupplier.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ChildAccountStatusSupplier.java
@@ -13,7 +13,6 @@ import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.supplier.OneshotSupplier;
import org.chromium.base.supplier.OneshotSupplierImpl;
import org.chromium.components.signin.AccountManagerFacade;
-import org.chromium.components.signin.AccountUtils;
/**
* Fetches the child account status to be used by other FRE components.
@@ -42,18 +41,6 @@ public class ChildAccountStatusSupplier implements OneshotSupplier<Boolean> {
AccountManagerFacade accountManagerFacade,
FirstRunAppRestrictionInfo appRestrictionInfo) {
mChildAccountStatusStartTime = SystemClock.elapsedRealtime();
-
- appRestrictionInfo.getHasAppRestriction(this::onAppRestrictionDetected);
-
- accountManagerFacade
- .getCoreAccountInfos()
- .then(
- coreAccountInfos -> {
- AccountUtils.checkChildAccountStatus(
- accountManagerFacade,
- coreAccountInfos,
- (isChild, account) -> onChildAccountStatusReady(isChild));
- });
}
@Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/DefaultSearchEngineFirstRunFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/DefaultSearchEngineFirstRunFragment.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/DefaultSearchEngineFirstRunFragment.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/DefaultSearchEngineFirstRunFragment.java
@@ -51,15 +51,12 @@ public class DefaultSearchEngineFirstRunFragment extends Fragment implements Fir
Profile profile = getPageDelegate().getProfileProviderSupplier().get().getOriginalProfile();
assert TemplateUrlServiceFactory.getForProfile(profile).isLoaded();
- mSearchEnginePromoDialogType = LocaleManager.getInstance().getSearchEnginePromoShowType();
- if (mSearchEnginePromoDialogType != SearchEnginePromoType.DONT_SHOW) {
new DefaultSearchEngineDialogHelper(
mSearchEnginePromoDialogType,
LocaleManager.getInstance(),
mEngineLayout,
mButton,
getPageDelegate()::advanceToNextPage);
- }
return rootView;
}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java
@@ -31,8 +31,7 @@ import org.chromium.chrome.browser.fonts.FontPreloader;
import org.chromium.chrome.browser.metrics.UmaUtils;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
-import org.chromium.chrome.browser.signin.SigninCheckerProvider;
-import org.chromium.chrome.browser.signin.SigninFirstRunFragment;
+import org.chromium.chrome.browser.firstrun.ToSAndUMAFirstRunFragment;
import org.chromium.components.browser_ui.modaldialog.AppModalPresenter;
import org.chromium.components.feature_engagement.EventConstants;
import org.chromium.components.metrics.LowEntropySource;
@@ -121,7 +120,7 @@ public class FirstRunActivity extends FirstRunActivityBase implements FirstRunPa
/** Creates first page and sets up adapter. Should result UI being shown on the screen. */
private void createFirstPage() {
BooleanSupplier showWelcomePage = () -> !FirstRunStatus.shouldSkipWelcomePage();
- mPages.add(new FirstRunPage<>(SigninFirstRunFragment.class, showWelcomePage));
+ mPages.add(new FirstRunPage<>(ToSAndUMAFirstRunFragment.class, showWelcomePage));
mFreProgressStates.add(MobileFreProgress.WELCOME_SHOWN);
mPagerAdapter = new FirstRunPagerAdapter(FirstRunActivity.this, mPages);
mPager.setAdapter(mPagerAdapter);
@@ -143,7 +142,6 @@ public class FirstRunActivity extends FirstRunActivityBase implements FirstRunPa
//
// TODO(b/245912657): explicitly sign in supervised users in {@link
// SigninFirstRunMediator#handleContinueWithNative} rather than relying on SigninChecker.
- SigninCheckerProvider.get(getProfileProviderSupplier().get().getOriginalProfile());
mFirstRunFlowSequencer.updateFirstRunProperties(mFreProperties);
@@ -158,20 +156,6 @@ public class FirstRunActivity extends FirstRunActivityBase implements FirstRunPa
mFreProgressStates.add(MobileFreProgress.DEFAULT_SEARCH_ENGINE_SHOWN);
}
- // An optional sync consent page, the visibility of this page will be decided on the fly
- // according to the situation.
- if (ChromeFeatureList.isEnabled(
- ChromeFeatureList.REPLACE_SYNC_PROMOS_WITH_SIGN_IN_PROMOS)) {
- BooleanSupplier showHistorySync =
- () -> mFreProperties.getBoolean(SHOW_HISTORY_SYNC_PAGE);
- mPages.add(new FirstRunPage<>(HistorySyncFirstRunFragment.class, showHistorySync));
- } else {
- BooleanSupplier showSyncConsent =
- () -> mFreProperties.getBoolean(SHOW_SYNC_CONSENT_PAGE);
- mPages.add(new FirstRunPage<>(SyncConsentFirstRunFragment.class, showSyncConsent));
- }
- mFreProgressStates.add(MobileFreProgress.SYNC_CONSENT_SHOWN);
-
if (mPagerAdapter != null) {
mPagerAdapter.notifyDataSetChanged();
}
@@ -522,11 +506,6 @@ public class FirstRunActivity extends FirstRunActivityBase implements FirstRunPa
public void acceptTermsOfService(boolean allowMetricsAndCrashUploading) {
assert mNativeInitializationPromise.isFulfilled();
- // If default is true then it corresponds to opt-out and false corresponds to opt-in.
- UmaUtils.recordMetricsReportingDefaultOptIn(!DEFAULT_METRICS_AND_CRASH_REPORTING);
- RecordHistogram.recordMediumTimesHistogram(
- "MobileFre.FromLaunch.TosAccepted",
- SystemClock.elapsedRealtime() - mIntentCreationElapsedRealtimeMs);
FirstRunUtils.acceptTermsOfService(allowMetricsAndCrashUploading);
FirstRunStatus.setSkipWelcomePage(true);
flushPersistentData();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java
@@ -38,8 +38,6 @@ import org.chromium.chrome.browser.profiles.ProfileProvider;
import org.chromium.chrome.browser.ui.system.StatusBarColorController;
import org.chromium.components.browser_ui.widget.gesture.BackPressHandler;
import org.chromium.components.policy.PolicyService;
-import org.chromium.components.signin.AccountManagerFacade;
-import org.chromium.components.signin.AccountManagerFacadeProvider;
/** Base class for First Run Experience. */
public abstract class FirstRunActivityBase extends AsyncInitializationActivity
@@ -112,9 +110,7 @@ public abstract class FirstRunActivityBase extends AsyncInitializationActivity
@Override
@CallSuper
public void triggerLayoutInflation() {
- AccountManagerFacade accountManagerFacade = AccountManagerFacadeProvider.getInstance();
- mChildAccountStatusSupplier =
- new ChildAccountStatusSupplier(accountManagerFacade, mFirstRunAppRestrictionInfo);
+ mChildAccountStatusSupplier = new ChildAccountStatusSupplier(null, null);
// TODO(crbug.com/1498708): Find the underlying issue causing the status bar not to be set
// during FRE, this is just a temporary visual fix.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java
@@ -28,14 +28,9 @@ import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileProvider;
import org.chromium.chrome.browser.search_engines.SearchEnginePromoType;
-import org.chromium.chrome.browser.signin.services.IdentityServicesProvider;
-import org.chromium.chrome.browser.signin.services.SigninManager;
import org.chromium.components.crash.CrashKeyIndex;
import org.chromium.components.crash.CrashKeys;
import org.chromium.components.embedder_support.util.UrlConstants;
-import org.chromium.components.signin.AccountManagerFacadeProvider;
-import org.chromium.components.signin.identitymanager.ConsentLevel;
-import org.chromium.components.signin.identitymanager.IdentityManager;
/**
* A helper to determine what should be the sequence of First Run Experience screens, and whether
@@ -63,41 +58,19 @@ public abstract class FirstRunFlowSequencer {
/** Returns true if the sync consent promo page should be shown. */
boolean shouldShowSyncConsentPage(boolean isChild) {
- if (isChild) {
- // Always show the sync consent page for child account.
- return true;
- }
- assert mProfileSupplier.get() != null;
- Profile profile = mProfileSupplier.get().getOriginalProfile();
- // TODO(crbug.com/1520791): Review this logic for history sync for UNO.
- final IdentityManager identityManager =
- IdentityServicesProvider.get().getIdentityManager(profile);
- if (identityManager.hasPrimaryAccount(ConsentLevel.SYNC) || !isSyncAllowed()) {
- // No need to show the sync consent page if users already consented to sync or
- // if sync is not allowed.
- return false;
- }
- // Show the sync consent page only to the signed-in users.
- return identityManager.hasPrimaryAccount(ConsentLevel.SIGNIN);
+ return false;
}
/** @return true if the Search Engine promo page should be shown. */
@VisibleForTesting
public boolean shouldShowSearchEnginePage() {
- @SearchEnginePromoType
- int searchPromoType = LocaleManager.getInstance().getSearchEnginePromoShowType();
- return searchPromoType == SearchEnginePromoType.SHOW_NEW
- || searchPromoType == SearchEnginePromoType.SHOW_EXISTING;
+ return true;
}
/** @return true if Sync is allowed for the current user. */
@VisibleForTesting
protected boolean isSyncAllowed() {
- Profile profile = mProfileSupplier.get().getOriginalProfile();
- SigninManager signinManager = IdentityServicesProvider.get().getSigninManager(profile);
- return FirstRunUtils.canAllowSync()
- && !signinManager.isSigninDisabledByPolicy()
- && signinManager.isSigninSupported(/* requireUpdatedPlayServices= */ false);
+ return false;
}
}
@@ -153,18 +126,8 @@ public abstract class FirstRunFlowSequencer {
* method.
*/
void start() {
- AccountManagerFacadeProvider.getInstance()
- .getCoreAccountInfos()
- .then(
- coreAccountInfos -> {
- RecordHistogram.recordCount1MHistogram(
- "Signin.AndroidDeviceAccountsNumberWhenEnteringFRE",
- Math.min(coreAccountInfos.size(), 2));
-
- assert !mAccountsAvailable;
- mAccountsAvailable = true;
- maybeProcessFreEnvironmentPreNative();
- });
+ mIsChild = false;
+ maybeProcessFreEnvironmentPreNative();
}
@VisibleForTesting
@@ -183,14 +146,10 @@ public abstract class FirstRunFlowSequencer {
}
private void maybeProcessFreEnvironmentPreNative() {
- // Wait till both child account status and the list of accounts are available.
- if (mIsChild == null || !mAccountsAvailable) return;
-
if (mIsFlowKnown) return;
mIsFlowKnown = true;
Bundle freProperties = new Bundle();
- freProperties.putBoolean(SyncConsentFirstRunFragment.IS_CHILD_ACCOUNT, mIsChild);
onFlowIsKnown(freProperties);
}
@@ -201,6 +160,8 @@ public abstract class FirstRunFlowSequencer {
* @param freProperties Resulting FRE properties bundle.
*/
public void updateFirstRunProperties(Bundle freProperties) {
+ if (freProperties == null)
+ throw new RuntimeException("attempting to update null FRE properties");
boolean isHistorySyncEnabled =
ChromeFeatureList.isEnabled(
ChromeFeatureList.REPLACE_SYNC_PROMOS_WITH_SIGN_IN_PROMOS);
@@ -311,13 +272,17 @@ public abstract class FirstRunFlowSequencer {
if (!(caller instanceof Activity)) {
freIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
- IntentUtils.safeStartActivity(caller, freIntent);
+ if (!IntentUtils.safeStartActivity(caller, freIntent)) {
+ throw new RuntimeException("Cannot start FirstRunExperience activity");
+ }
} else {
// First Run requires that the Intent contains NEW_TASK so that it doesn't sit on top
// of something else.
Intent newIntent = new Intent(fromIntent);
newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- IntentUtils.safeStartActivity(caller, newIntent);
+ if (!IntentUtils.safeStartActivity(caller, newIntent)) {
+ throw new RuntimeException("Cannot start FirstRunExperience activity");
+ }
}
return true;
}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunUtils.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunUtils.java
@@ -20,9 +20,6 @@ import org.chromium.chrome.browser.metrics.ChangeMetricsReportingStateCalledFrom
import org.chromium.chrome.browser.metrics.UmaSessionStats;
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
-import org.chromium.components.signin.AccountManagerFacade;
-import org.chromium.components.signin.AccountManagerFacadeProvider;
-import org.chromium.components.signin.AccountUtils;
import org.chromium.ui.accessibility.AccessibilityState;
/** Provides first run related utility functions. */
@@ -85,16 +82,12 @@ public class FirstRunUtils {
* @return Whether or not sync is allowed on this device.
*/
static boolean canAllowSync() {
- return (hasGoogleAccountAuthenticator() && hasSyncPermissions()) || hasGoogleAccounts();
+ return false;
}
@VisibleForTesting
static boolean hasGoogleAccountAuthenticator() {
- if (sHasGoogleAccountAuthenticator == null) {
- AccountManagerFacade accountHelper = AccountManagerFacadeProvider.getInstance();
- sHasGoogleAccountAuthenticator = accountHelper.hasGoogleAccountAuthenticator();
- }
- return sHasGoogleAccountAuthenticator;
+ return false;
}
@VisibleForTesting
@@ -104,9 +97,7 @@ public class FirstRunUtils {
@VisibleForTesting
static boolean hasGoogleAccounts() {
- return !AccountUtils.getCoreAccountInfosIfFulfilledOrEmpty(
- AccountManagerFacadeProvider.getInstance().getCoreAccountInfos())
- .isEmpty();
+ return false;
}
@SuppressLint("InlinedApi")
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java
new file mode 100644
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java
@@ -0,0 +1,335 @@
+// Copyright 2015 The Chromium Authors
+// 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.firstrun;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.os.SystemClock;
+import android.text.method.LinkMovementMethod;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.accessibility.AccessibilityEvent;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.TextView;
+
+import android.content.SharedPreferences;
+import org.chromium.chrome.browser.omaha.OmahaBase;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.VisibleForTesting;
+import androidx.fragment.app.Fragment;
+
+import org.chromium.base.Log;
+import org.chromium.base.metrics.RecordHistogram;
+import org.chromium.chrome.R;
+import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl;
+import org.chromium.ui.modaldialog.ModalDialogManagerHolder;
+import org.chromium.ui.text.NoUnderlineClickableSpan;
+import org.chromium.ui.text.SpanApplier;
+import org.chromium.ui.text.SpanApplier.SpanInfo;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * The First Run Experience fragment that allows the user to accept Terms of Service ("ToS") and
+ * Privacy Notice, and to opt-in to the usage statistics and crash reports collection ("UMA",
+ * User Metrics Analysis) as defined in the Chrome Privacy Notice.
+ */
+public class ToSAndUMAFirstRunFragment
+ extends Fragment implements FirstRunFragment {
+ /** Alerts about some methods once ToSAndUMAFirstRunFragment executes them. */
+ public interface Observer {
+ /** See {@link #onNativeInitialized}. */
+ public void onNativeInitialized();
+ public void onPolicyServiceInitialized();
+ public void onHideLoadingUIComplete();
+ }
+
+ private static boolean sShowUmaCheckBoxForTesting;
+
+ @Nullable
+ private static ToSAndUMAFirstRunFragment.Observer sObserver;
+
+ private boolean mNativeInitialized;
+ private boolean mPolicyServiceInitialized;
+ private boolean mTosButtonClicked;
+ private boolean mAllowMetricsAndCrashUploading;
+ private boolean mUserInteractedWithUmaCheckbox;
+
+ private Button mAcceptButton;
+ private CheckBox mAutoUpdaterCheckBox;
+ private boolean mAutoUpdaterChecked;
+ private TextView mTosAndPrivacy;
+ private View mTitle;
+ private View mProgressSpinner;
+
+ private long mTosAcceptedTime;
+
+ @Override
+ public View onCreateView(
+ LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fre_tosanduma, container, false);
+ }
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ super.onAttach(context);
+ getPageDelegate().getPolicyLoadListener().onAvailable(this::onPolicyServiceInitialized);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ mTitle = view.findViewById(R.id.title);
+ mProgressSpinner = view.findViewById(R.id.progress_spinner);
+ mProgressSpinner.setVisibility(View.GONE);
+ mAcceptButton = (Button) view.findViewById(R.id.terms_accept);
+ mAutoUpdaterCheckBox = (CheckBox) view.findViewById(R.id.auto_updater_checkbox);
+ mTosAndPrivacy = (TextView) view.findViewById(R.id.tos_and_privacy);
+
+ // Register event listeners.
+ mAcceptButton.setOnClickListener((v) -> onTosButtonClicked());
+ mAutoUpdaterCheckBox.setOnCheckedChangeListener(
+ ((compoundButton, isChecked) -> {
+ mAutoUpdaterChecked = isChecked;
+ }));
+
+ // Make TextView links clickable.
+ mTosAndPrivacy.setMovementMethod(LinkMovementMethod.getInstance());
+
+ updateView();
+
+ // If this page should be skipped, it can be one of the following cases:
+ // 1. Native hasn't been initialized yet and this page will be skipped once that happens.
+ // 2. The user has moved back to this page after advancing past it. In this case, this
+ // may not even be the same object as before, as the fragment may have been re-created.
+ //
+ // In case 1, hide all the elements except for Chrome logo and the spinner until native gets
+ // initialized at which point the activity will skip the page.
+ // We distinguish case 1 from case 2 by the value of |mNativeInitialized|, as that is set
+ // via onAttachFragment() from FirstRunActivity - which is before this onViewCreated().
+ boolean isW = isWaitingForNativeAndPolicyInit();
+ boolean ssw = FirstRunStatus.shouldSkipWelcomePage();
+ if (isW && ssw) {
+ setSpinnerVisible(true);
+ }
+ }
+
+ @Override
+ public void setInitialA11yFocus() {
+ // Ignore calls before view is created.
+ if (mTitle == null) return;
+ mTitle.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
+ }
+
+ @Override
+ public void setUserVisibleHint(boolean isVisibleToUser) {
+ super.setUserVisibleHint(isVisibleToUser);
+
+ // This may be called before onViewCreated(), in which case the below is not yet relevant.
+ if (mTitle == null) return;
+
+ if (!isVisibleToUser) {
+ // Restore original enabled & visibility states, in case the user returns to the page.
+ setSpinnerVisible(false);
+ } else {
+ // On certain versions of Android, the checkbox will appear unchecked upon revisiting
+ // the page. Force it to the end state of the drawable animation as a work around.
+ // crbug.com/666258
+ mAutoUpdaterCheckBox.jumpDrawablesToCurrentState();
+ }
+ }
+
+ @Override
+ public void onNativeInitialized() {
+ assert !mNativeInitialized;
+
+ mNativeInitialized = true;
+ tryMarkTermsAccepted(false);
+
+ if (mPolicyServiceInitialized) {
+ onNativeAndPolicyServiceInitialized();
+ }
+
+ if (sObserver != null) {
+ sObserver.onNativeInitialized();
+ }
+ }
+
+ @Override
+ public void reset() {
+ // We cannot pass the welcome page when native or policy is not initialized. When this page
+ // is revisited, this means this page is persist and we should re-show the ToS And UMA.
+ assert !isWaitingForNativeAndPolicyInit();
+
+ setSpinnerVisible(false);
+ mAutoUpdaterCheckBox.setChecked(true);
+ }
+
+ private void updateView() {
+ // Avoid early calls.
+ if (getPageDelegate() == null) {
+ return;
+ }
+
+ updateTosText();
+
+ updateReportCheckbox();
+ }
+
+ private SpanInfo buildPrivacyPolicyLink(String suffix, int url) {
+ NoUnderlineClickableSpan clickableSpan =
+ new NoUnderlineClickableSpan(getContext(), (view1) -> {
+ if (!isAdded()) return;
+ getPageDelegate().showInfoPage(url);
+ });
+
+ return new SpanInfo("<PRIVACY_LINK" + suffix + ">", "</PRIVACY_LINK" + suffix + ">", clickableSpan);
+ }
+
+ private void updateTosText() {
+ List<SpanInfo> spans = new LinkedList<SpanInfo>();
+
+ spans.add(buildPrivacyPolicyLink("1", R.string.adblock_wiki_url));
+
+ spans.add(buildPrivacyPolicyLink("2", R.string.adblock_updater_privacy_policy_url));
+
+ spans.add(buildPrivacyPolicyLink("3", R.string.auto_updates_wiki_url));
+
+ spans.add(buildPrivacyPolicyLink("4", R.string.bromite_updater_privacy_policy_url));
+
+ String tosString = getString(R.string.bromite_fre_footer_privacy_policy);
+
+ mTosAndPrivacy.setText(SpanApplier.applySpans(tosString, spans.toArray(new SpanInfo[0])));
+ }
+
+ private void updateReportCheckbox() {
+ mAutoUpdaterCheckBox.setChecked(true);
+ }
+
+ private void onPolicyServiceInitialized(boolean onDevicePolicyFound) {
+ assert !mPolicyServiceInitialized;
+
+ mPolicyServiceInitialized = true;
+ tryMarkTermsAccepted(false);
+
+ if (mNativeInitialized) {
+ onNativeAndPolicyServiceInitialized();
+ }
+
+ if (sObserver != null) {
+ sObserver.onPolicyServiceInitialized();
+ }
+ }
+
+ private void onNativeAndPolicyServiceInitialized() {
+ // Once we have native & policies, Check whether metrics reporting are permitted by policy
+ // and update interface accordingly.
+ updateView();
+ }
+
+ private void onTosButtonClicked() {
+ mTosButtonClicked = true;
+ mTosAcceptedTime = SystemClock.elapsedRealtime();
+
+ // save updater configuration only on button click
+ SharedPreferences.Editor sharedPreferenceEditor = OmahaBase.getSharedPreferences().edit();
+ sharedPreferenceEditor.putBoolean(OmahaBase.PREF_ALLOW_INLINE_UPDATE, mAutoUpdaterChecked);
+ sharedPreferenceEditor.apply();
+
+ tryMarkTermsAccepted(true);
+ }
+
+ /**
+ * This should be called Tos button is clicked for a fresh new FRE, or when native and policies
+ * are initialized if Tos has ever been accepted.
+ *
+ * @param fromButtonClicked Whether called from {@link #onTosButtonClicked()}.
+ */
+ private void tryMarkTermsAccepted(boolean fromButtonClicked) {
+ boolean isW = isWaitingForNativeAndPolicyInit();
+ if (!mTosButtonClicked || isW) {
+ if (fromButtonClicked) setSpinnerVisible(true);
+ return;
+ }
+
+ // In cases where the attempt is triggered other than button click, the ToS should have been
+ // accepted by the user already.
+ if (!fromButtonClicked) {
+ RecordHistogram.recordTimesHistogram("MobileFre.TosFragment.SpinnerVisibleDuration",
+ SystemClock.elapsedRealtime() - mTosAcceptedTime);
+ }
+ getPageDelegate().acceptTermsOfService(false);
+ getPageDelegate().advanceToNextPage();
+ }
+
+ private void setSpinnerVisible(boolean spinnerVisible) {
+ // When the progress spinner is visible, we hide the other UI elements so that
+ // the user can't interact with them.
+ boolean otherElementVisible = !spinnerVisible;
+
+ setTosAndUmaVisible(otherElementVisible);
+ mTitle.setVisibility(otherElementVisible ? View.VISIBLE : View.INVISIBLE);
+ mProgressSpinner.setVisibility(spinnerVisible ? View.VISIBLE : View.GONE);
+ }
+
+ private boolean isWaitingForNativeAndPolicyInit() {
+ return !mNativeInitialized || !mPolicyServiceInitialized;
+ }
+
+ private boolean getUmaCheckBoxInitialState() {
+ // Metrics and crash reporting could not be permitted by policy.
+ if (!isWaitingForNativeAndPolicyInit()
+ && !PrivacyPreferencesManagerImpl.getInstance()
+ .isUsageAndCrashReportingPermittedByPolicy()) {
+ return false;
+ }
+
+ // A user could start FRE and accept terms of service, then close the browser and start
+ // again. In this case we rely on whatever state the user has already set.
+ if (FirstRunUtils.didAcceptTermsOfService()) {
+ return PrivacyPreferencesManagerImpl.getInstance()
+ .isUsageAndCrashReportingPermittedByUser();
+ }
+
+ return FirstRunActivity.DEFAULT_METRICS_AND_CRASH_REPORTING;
+ }
+
+ // Exposed methods for ToSAndUMACCTFirstRunFragment
+
+ protected void setTosAndUmaVisible(boolean isVisible) {
+ int visibility = isVisible ? View.VISIBLE : View.GONE;
+
+ mAcceptButton.setVisibility(visibility);
+ mTosAndPrivacy.setVisibility(visibility);
+ mAutoUpdaterCheckBox.setVisibility(visibility);
+ }
+
+ protected View getToSAndPrivacyText() {
+ return mTosAndPrivacy;
+ }
+
+ protected void onHideLoadingUIComplete() {
+ if (sObserver != null) {
+ sObserver.onHideLoadingUIComplete();
+ }
+ }
+
+ @VisibleForTesting
+ public static void setShowUmaCheckBoxForTesting(boolean showForTesting) {
+ sShowUmaCheckBoxForTesting = showForTesting;
+ }
+
+ @VisibleForTesting
+ public static void setObserverForTesting(ToSAndUMAFirstRunFragment.Observer observer) {
+ assert observer == null || sObserver == null;
+ sObserver = observer;
+ }
+}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/TosAndUmaFragmentView.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/TosAndUmaFragmentView.java
new file mode 100644
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/TosAndUmaFragmentView.java
@@ -0,0 +1,336 @@
+// Copyright 2020 The Chromium Authors
+// 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.firstrun;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.Gravity;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+import android.widget.ScrollView;
+
+import org.chromium.chrome.R;
+
+/**
+ * Base view for fre_tosanduma.xml. This view may change child view placement when changing screen
+ * dimensions (e.g. on rotation).
+ *
+ * See https://crbug.com/1151537 for illustration.
+ */
+public class TosAndUmaFragmentView extends RelativeLayout {
+ private ScrollView mScrollView;
+
+ private LinearLayout mMainLayout;
+
+ // The "title and content" contains the mTitle, mContentWrapper, and mLoadingSpinner that is
+ // visible when waiting for policy to be loaded.
+ private View mTitleAndContent;
+
+ // The "content wrapper" contains the ToS text and the UMA check box.
+ private View mContentWrapper;
+
+ // The "bottom group" contains the accept & continue button, and a small spinner that displays
+ // in its place when waiting for C++ to load before processing the FRE screen.
+ private View mBottomGroup;
+
+ private View mTitle;
+ private View mLogo;
+ private View mLoadingSpinnerContainer;
+ private View mPrivacyDisclaimer;
+ private View mShadow;
+
+ private int mLastHeight;
+ private int mLastWidth;
+
+ // Spacing params
+ private int mImageBottomMargin;
+ private int mVerticalSpacing;
+ private int mImageSize;
+ private int mLoadingSpinnerSize;
+ private int mLandscapeTopPadding;
+ private int mHeadlineSize;
+ private int mContentMargin;
+ private int mAcceptButtonHeight;
+ private int mBottomGroupVerticalMarginRegular;
+ private int mBottomGroupVerticalMarginSmall;
+
+ // Store the bottom margins for different screen orientations. We are using a smaller bottom
+ // margin when the content becomes scrollable. Storing margins per orientation because there are
+ // cases where content is scrollable in landscape mode while not in portrait mode.
+ private int mBottomMarginPortrait;
+ private int mBottomMarginLandscape;
+
+ /**
+ * Constructor for inflating via XML.
+ */
+ public TosAndUmaFragmentView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+
+ mScrollView = findViewById(R.id.scroll_view);
+
+ mMainLayout = findViewById(R.id.fre_main_layout);