From f4bcdd12fb6a6ea351e6da809d6e6c6a29745264 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Sun, 2 Jun 2019 14:47:39 +0200 Subject: [PATCH 1/9] SetupWizard: Add /e/ account manager page --- AndroidManifest.xml | 15 ++++ res/drawable/ic_account_manager_screen.xml | 29 +++++++ res/layout/setup_e_account_manager.xml | 61 +++++++++++++ res/raw/lineage_wizard_script.xml | 13 ++- res/values/strings.xml | 5 ++ .../setupwizard/EAccountManagerActivity.java | 86 +++++++++++++++++++ .../lineageos/setupwizard/SetupWizardApp.java | 2 + 7 files changed, 209 insertions(+), 2 deletions(-) create mode 100644 res/drawable/ic_account_manager_screen.xml create mode 100644 res/layout/setup_e_account_manager.xml create mode 100644 src/org/lineageos/setupwizard/EAccountManagerActivity.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index d68f421c..3d4413a9 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2,6 +2,7 @@ + + + + + diff --git a/res/layout/setup_e_account_manager.xml b/res/layout/setup_e_account_manager.xml new file mode 100644 index 00000000..89aba7a6 --- /dev/null +++ b/res/layout/setup_e_account_manager.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/raw/lineage_wizard_script.xml b/res/raw/lineage_wizard_script.xml index cb404ebf..793177f8 100644 --- a/res/raw/lineage_wizard_script.xml +++ b/res/raw/lineage_wizard_script.xml @@ -3,6 +3,7 @@ @@ -68,12 +71,18 @@ - + + + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index 8253bc5d..7f9486c8 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2,6 +2,7 @@ + Setup /e/ account + Save your /e/ identifiers in the account manager, therefore you can simply reuse them later in other applications. diff --git a/src/org/lineageos/setupwizard/EAccountManagerActivity.java b/src/org/lineageos/setupwizard/EAccountManagerActivity.java new file mode 100644 index 00000000..01c31776 --- /dev/null +++ b/src/org/lineageos/setupwizard/EAccountManagerActivity.java @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2018-2021 E FOUNDATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.lineageos.setupwizard; + +import static org.lineageos.setupwizard.SetupWizardApp.ACCOUNT_TYPE_E; +import static org.lineageos.setupwizard.SetupWizardApp.REQUEST_CODE_SETUP_ACCOUNT_TYPE_E; + +import android.accounts.Account; +import android.accounts.AccountManager; +import android.content.Intent; +import android.provider.Settings; +import android.util.Log; + +import org.lineageos.setupwizard.util.SetupWizardUtils; + +public class EAccountManagerActivity extends SubBaseActivity { + + public static final String TAG = EAccountManagerActivity.class.getSimpleName(); + + @Override + protected void onStartSubactivity() { + setNextAllowed(true); + } + + @Override + protected void onSubactivityResult(int requestCode, int resultCode, Intent data) { + // AccountManager activity always return resultCode as 0, check manually + if (isEAccountAvailable()) { + Log.v(TAG, "An E account is already set up; skipping EAccountManagerActivity"); + nextAction(RESULT_OK); + } else { + super.onSubactivityResult(requestCode, resultCode, data); + } + } + + @Override + protected void onNextPressed() { + launchAccountManagerSetup(); + } + + @Override + protected int getLayoutResId() { + return R.layout.setup_e_account_manager; + } + + @Override + protected int getTitleResId() { + return R.string.e_account_manager_setup_title; + } + + @Override + protected int getIconResId() { + return R.drawable.ic_account_manager_screen; + } + + private void launchAccountManagerSetup() { + Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT) + .putExtra(Settings.EXTRA_ACCOUNT_TYPES, new String[]{ACCOUNT_TYPE_E}); + startSubactivity(intent, REQUEST_CODE_SETUP_ACCOUNT_TYPE_E); + } + + private boolean isEAccountAvailable() { + Account[] allAccounts = getSystemService(AccountManager.class).getAccounts(); + for (Account account : allAccounts) { + if (account.type.equals(ACCOUNT_TYPE_E)) { + return true; + } + } + return false; + } + +} diff --git a/src/org/lineageos/setupwizard/SetupWizardApp.java b/src/org/lineageos/setupwizard/SetupWizardApp.java index dcfe3bc8..b097ee47 100644 --- a/src/org/lineageos/setupwizard/SetupWizardApp.java +++ b/src/org/lineageos/setupwizard/SetupWizardApp.java @@ -66,6 +66,7 @@ public class SetupWizardApp extends Application { public static final String UPDATE_RECOVERY_PROP = "persist.vendor.recovery_update"; public static final String NAVIGATION_OPTION_KEY = "navigation_option"; + public static final String ACCOUNT_TYPE_E = "e.foundation.webdav.eelo"; public static final int REQUEST_CODE_SETUP_NETWORK = 0; public static final int REQUEST_CODE_SETUP_CAPTIVE_PORTAL = 4; @@ -73,6 +74,7 @@ public class SetupWizardApp extends Application { public static final int REQUEST_CODE_SETUP_BIOMETRIC = 7; public static final int REQUEST_CODE_SETUP_LOCKSCREEN = 9; public static final int REQUEST_CODE_RESTORE = 10; + public static final int REQUEST_CODE_SETUP_ACCOUNT_TYPE_E = 11; public static final int RADIO_READY_TIMEOUT = 10 * 1000; -- GitLab From 7713737a78f6ad5097a42ae3e40798dd65c1f393 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Tue, 14 Sep 2021 15:43:55 +0530 Subject: [PATCH 2/9] SetupWizard: Disable LineageOS metrics --- src/org/lineageos/setupwizard/FinishActivity.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/org/lineageos/setupwizard/FinishActivity.java b/src/org/lineageos/setupwizard/FinishActivity.java index 95e31661..9d033427 100644 --- a/src/org/lineageos/setupwizard/FinishActivity.java +++ b/src/org/lineageos/setupwizard/FinishActivity.java @@ -1,6 +1,7 @@ /* * Copyright (C) 2016 The CyanogenMod Project * Copyright (C) 2017-2020, 2022 The LineageOS Project + * * Copyright (C) 2018-2022 E FOUNDATION * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -175,7 +176,7 @@ public class FinishActivity extends BaseSetupWizardActivity { } private void completeSetup() { - handleEnableMetrics(mSetupWizardApp); + handleDisableMetrics(mSetupWizardApp); handleNavKeys(mSetupWizardApp); handleRecoveryUpdate(mSetupWizardApp); handleNavigationOption(mSetupWizardApp); @@ -189,15 +190,9 @@ public class FinishActivity extends BaseSetupWizardActivity { startActivityForResult(intent, NEXT_REQUEST); } - private static void handleEnableMetrics(SetupWizardApp setupWizardApp) { - Bundle privacyData = setupWizardApp.getSettingsBundle(); - if (privacyData != null - && privacyData.containsKey(KEY_SEND_METRICS)) { - LineageSettings.Secure.putInt(setupWizardApp.getContentResolver(), - LineageSettings.Secure.STATS_COLLECTION, - privacyData.getBoolean(KEY_SEND_METRICS) - ? 1 : 0); - } + private static void handleDisableMetrics(SetupWizardApp setupWizardApp) { + LineageSettings.Secure.putInt(setupWizardApp.getContentResolver(), + LineageSettings.Secure.STATS_COLLECTION, 0); } private static void handleNavKeys(SetupWizardApp setupWizardApp) { -- GitLab From 3e11141af42571182f76e6c572abb6a2b72e58c8 Mon Sep 17 00:00:00 2001 From: Alexandre Roux D'Anzi Date: Mon, 29 Jun 2020 14:12:21 +0200 Subject: [PATCH 3/9] SetupWizard: Enable wifi location Change-Id: I256e9b008850200b60154c83f1e32e93de45a967 Signed-off-by: Aayush Gupta --- src/org/lineageos/setupwizard/LocationSettingsActivity.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/org/lineageos/setupwizard/LocationSettingsActivity.java b/src/org/lineageos/setupwizard/LocationSettingsActivity.java index 846020bb..d547dedd 100644 --- a/src/org/lineageos/setupwizard/LocationSettingsActivity.java +++ b/src/org/lineageos/setupwizard/LocationSettingsActivity.java @@ -1,6 +1,7 @@ /* * Copyright (C) 2016 The CyanogenMod Project * Copyright (C) 2017-2021 The LineageOS Project + * Copyright (C) 2020-2021 E FOUNDATION * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +23,7 @@ import android.os.Bundle; import android.os.UserHandle; import android.view.View; import android.widget.CheckBox; +import android.provider.Settings; public class LocationSettingsActivity extends BaseSetupWizardActivity { @@ -45,6 +47,8 @@ public class LocationSettingsActivity extends BaseSetupWizardActivity { new UserHandle(UserHandle.USER_CURRENT)); mLocationAccess.setChecked(!mLocationAccess.isChecked()); }); + Settings.Global.putInt(getContentResolver(), + Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE,1); } @Override -- GitLab From 6917b693f1e57d3d3a60e2a1371c512034ab8a02 Mon Sep 17 00:00:00 2001 From: TheScarastic Date: Wed, 30 Mar 2022 08:00:02 +0000 Subject: [PATCH 4/9] SetupWizard: Change eDrive strings according to our needs --- res/values/strings.xml | 5 +++-- src/org/lineageos/setupwizard/EAccountManagerActivity.java | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 7f9486c8..c1b01029 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -118,6 +118,7 @@ Hide gestural navigation hint - Setup /e/ account - Save your /e/ identifiers in the account manager, therefore you can simply reuse them later in other applications. + Sync your cloud account + Log in with your e.email or murena.io ID to connect your personal account with this phone. This will enable to synchronize your emails, contacts, calendar events, pictures, videos, notes and tasks across this phone and your personal cloud. + Log in diff --git a/src/org/lineageos/setupwizard/EAccountManagerActivity.java b/src/org/lineageos/setupwizard/EAccountManagerActivity.java index 01c31776..b4f33ad5 100644 --- a/src/org/lineageos/setupwizard/EAccountManagerActivity.java +++ b/src/org/lineageos/setupwizard/EAccountManagerActivity.java @@ -33,6 +33,7 @@ public class EAccountManagerActivity extends SubBaseActivity { @Override protected void onStartSubactivity() { + setNextText(R.string.e_account_manager_setup_configure); setNextAllowed(true); } -- GitLab From 85af0f2b27a92718f121ecbf9cc31319a4b1219d Mon Sep 17 00:00:00 2001 From: Nishith Khanna Date: Wed, 13 Apr 2022 17:14:00 +0530 Subject: [PATCH 5/9] Add create account functionality --- res/layout/setup_e_account_manager.xml | 27 +++++++++++++++++- res/values/strings.xml | 3 ++ .../setupwizard/EAccountManagerActivity.java | 28 +++++++++++++++---- .../lineageos/setupwizard/SetupWizardApp.java | 2 ++ 4 files changed, 53 insertions(+), 7 deletions(-) diff --git a/res/layout/setup_e_account_manager.xml b/res/layout/setup_e_account_manager.xml index 89aba7a6..e9abf98c 100644 --- a/res/layout/setup_e_account_manager.xml +++ b/res/layout/setup_e_account_manager.xml @@ -47,6 +47,31 @@ style="@style/SudItemTitle.GlifDescription" android:text="@string/e_account_manager_setup_summary" /> +