Commit f7530417 authored by vincent's avatar vincent

port commit 0867f866 from eelo-0.1 to eelo-0.2

parent 688f4b85
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013 The CyanogenMod Project
Copyright (C) 2017 The LineageOS Project
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
Copyright (C) 2013 The CyanogenMod Project
Copyright (C) 2017 The LineageOS Project
Copyright (C) 2018 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.
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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
......@@ -25,6 +26,7 @@
<uses-permission android:name="android.permission.STATUS_BAR" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
<uses-permission android:name="android.permission.SET_TIME_ZONE" />
<uses-permission android:name="android.permission.SET_TIME" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
......@@ -34,7 +36,7 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS_PRIVILEGED" />
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
<uses-permission android:name="android.permission.MANAGE_USERS" />
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
......@@ -256,6 +258,20 @@
</intent-filter>
</activity>
<activity android:name=".EAccountManagerActivity"
android:label="@string/activity_label_empty"
android:excludeFromRecents="true"
android:configChanges="mcc|mnc"
android:immersive="true"
android:exported="false"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="org.lineageos.setupwizard.E_ACCOUNT_MANAGER_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".FinishActivity"
android:label="@string/activity_label_empty"
android:excludeFromRecents="true"
......
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2017 The LineageOS Project
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M0 0h24v24H0z" />
<path
android:fillColor="@color/black"
android:pathData="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1 .9 2 2
2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9
2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/primary">
<include layout="@layout/header_condensed" />
<FrameLayout android:id="@+id/page"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/content_margin_left"
android:paddingEnd="@dimen/content_margin_left"
style="@style/PageContent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/PageSummaryText"
android:textSize="16sp"
android:layout_marginBottom="@dimen/summary_margin_bottom"
android:paddingRight="@dimen/location_text_margin_right"
android:text="@string/e_account_manager_setup_summary" />
<Button
android:id="@+id/setup_e_account_manager"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/content_margin_left"
android:paddingRight="@dimen/location_text_margin_right"
android:gravity="center"
android:textSize="16sp"
android:textAllCaps="true"
android:textColor="@color/white"
android:background="@color/accent"
android:maxLines="1"
android:ellipsize="end"
android:text="@string/e_account_manager_setup_configure"/>
</LinearLayout>
</ScrollView>
</FrameLayout>
<fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar"
android:id="@+id/navigation_bar"
style="@style/setup_wizard_navbar_style" />
......@@ -70,12 +70,15 @@
</WizardAction>
<WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_LOCKSCREEN_SETTINGS;end" id="lockscreen_settings">
<result wizard:action="finish" />
<result wizard:action="e_account_manager_settings" />
</WizardAction>
<WizardAction wizard:uri="intent:#Intent;action=action=org.lineageos.setupwizard.E_ACCOUNT_MANAGER_SETTINGS;end" id="e_account_manager_settings">
<result wizard:action="finish" />
</WizardAction>
<WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_SETUP_COMPLETE;end" id="finish">
<result wizard:action="exit" />
</WizardAction>
<WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.EXIT;end" id="exit" />
</WizardScript>
......@@ -105,5 +105,7 @@
<string name="lockscreen_setup_summary"><b>Protect this device</b> and require a PIN, pattern, or password to unlock the screen</string>
<string name="lockscreen_setup_screen_lock_setup">Set up</string>
<!-- e.foundation -->
<string name="eelo_start_synchronizer_err">Cannot start eelo synchronizer</string>
<string name="e_account_manager_setup_title">Configure <b>/e/</b> account</string>
<string name="e_account_manager_setup_summary">Save your /e/ identifiers in the account manager, thus you can simply reuse them later in other applications.</string>
<string name="e_account_manager_setup_configure">Set up</string>
</resources>
/*
* Copyright (C) 2018 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 android.content.Intent;
import android.view.View;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountManagerCallback;
import android.accounts.AccountManagerFuture;
import android.os.Bundle;
public class EAccountManagerActivity extends SubBaseActivity {
public static final String TAG = EAccountManagerActivity.class.getSimpleName();
private static boolean isInit = false;
private AccountManager accountManager = null;
@Override
protected void onStartSubactivity() {
setNextAllowed(true);
findViewById(R.id.setup_e_account_manager).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
launchAccountManagerSetup();
}
});
}
@Override
protected int getTransition() {
return TRANSITION_ID_SLIDE;
}
@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() {
isInit = true;
try {
accountManager = AccountManager.get(this);
accountManager.addAccount("bitfire.at.davdroid.eelo", null, null, null, this, null, null);
}
catch (Exception e) {}
finally {}
}
@Override
protected int getSubactivityNextTransition() {
return TRANSITION_ID_SLIDE;
}
@Override
protected void onResume() {
super.onResume();
if (isInit == false)
return;
try {
Account[] accounts = accountManager.getAccounts();
if (accounts != null) {
// An eelo account has been created, goto the next screen
onNavigateNext();
}
}
catch (Exception e) {
onNavigateNext();
}
finally {}
}
}
......@@ -60,27 +60,12 @@ public class FinishActivity extends BaseSetupWizardActivity {
private volatile boolean mIsFinishing = false;
private final static int EELO_SYNCHRONIZER_REQUEST_CODE = 0x01;
private boolean hasError = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
hasError = false;
try {
Intent intent = new Intent("xxx.io.eelo.drive.LAUNCHER"); // TODO static
intent.putExtra("EELO_SETTINGS_LAUNCHER", "SETUP_WIZARD");
startActivityForResult(intent, EELO_SYNCHRONIZER_REQUEST_CODE);
} catch (android.content.ActivityNotFoundException err) {
hasError = true;
}
mSetupWizardApp = (SetupWizardApp) getApplication();
// mSetupWizardApp.getSettingsBundle().putBoolean(KEY_SEND_METRICS, false); // /e/ do *not* send metrics by default.
......@@ -91,31 +76,6 @@ public class FinishActivity extends BaseSetupWizardActivity {
setNextText(R.string.start);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//super must be called
//super.onActivityResult(requestCode, resultCode, data);
if (requestCode==EELO_SYNCHRONIZER_REQUEST_CODE) {
//String message=data.getStringExtra("MESSAGE");
//alert(message);
if (resultCode == RESULT_CANCELED) {
//This is a BACK, or the Activity has not been found.
if (!hasError) {
// If the activity has not been found do *NOT* return back! (we will be in a (custom) loop)
onBackPressed();
}
}
}
}
@Override
protected int getTransition() {
return TRANSITION_ID_SLIDE;
......
......@@ -52,7 +52,6 @@ public class SetupWizardExitActivity extends BaseSetupWizardActivity {
SetupWizardUtils.enableCaptivePortalDetection(this);
PhoneMonitor.onSetupFinished();
launchHome();
launchEeloSynchronizer();
finish();
applyForwardTransition(TRANSITION_ID_FADE);
Intent i = new Intent();
......@@ -65,22 +64,4 @@ public class SetupWizardExitActivity extends BaseSetupWizardActivity {
.addCategory("android.intent.category.HOME")
.addFlags(FLAG_ACTIVITY_NEW_TASK|FLAG_ACTIVITY_CLEAR_TASK));
}
/*
* Launch eelo synchronizer service
*/
private final void launchEeloSynchronizer() {
try {
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_BOOT_COMPLETED);
ComponentName receiver = new ComponentName("io.eelo.synchronizer",
"io.eelo.synchronizer.triggers.BootCompleteReceiver");
PackageManager pm = getPackageManager();
pm.setComponentEnabledSetting(receiver,
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT,
PackageManager.DONT_KILL_APP);
} catch (java.lang.Throwable t) {
//Toast.makeText(getApplicationContext(), getString(R.string.eelo_start_synchronizer_err), Toast.LENGTH_LONG).show();
}
}
}
\ No newline at end of file
  • Two error in this commit:

    • Missing closing line in "res/layout/setup_e_account_manager.xml"
    • Copy/paste issues in "res/raw/lineage_wizard_script.xml" (at new line 76 : action=action=org. should be replaced by action=org.

    Fixed later

  • mentioned in commit 37d2320e

    Toggle commit list
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