Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78c1a977 authored by Torsten Grote's avatar Torsten Grote Committed by Michael Bestas
Browse files

Allow the user to change the BackupTransport

Set the following config overlays to activate this feature:

* config_backup_settings_intent to settings://com.android.settings.backup.transport
* config_backup_settings_label to some user-facing label
  e.g. Change backup provider

Change-Id: I080d96e2c34045a0e61f3fa1b839f463550f2028
parent c1bab3e3
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -3408,6 +3408,18 @@
                       android:value="com.android.settings.sound.MediaControlsSettings" />
        </activity>

        <activity android:name=".backup.transport.TransportActivity"
                  android:label="@string/backup_transport_title"
                  android:icon="@drawable/ic_settings_backup"
                  android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="settings"
                      android:host="com.android.settings.backup.transport" />
            </intent-filter>
        </activity>

        <!-- This is the longest AndroidManifest.xml ever. -->
    </application>
</manifest>
+4 −0
Original line number Diff line number Diff line
@@ -112,4 +112,8 @@
    <!-- Wake on plug -->
    <string name="wake_when_plugged_or_unplugged_title">Wake on plug</string>
    <string name="wake_when_plugged_or_unplugged_summary">Turn the screen on when connecting or disconnecting a power source</string>

    <!-- Backup Transport selection settings menu and activity title -->
    <string name="backup_transport_setting_label">Change backup provider</string>
    <string name="backup_transport_title">Select backup provider</string>
</resources>
+24 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2020 The Calyx Institute
  ~
  ~ 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
  -->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:title="@string/backup_transport_title">

    <!-- content gets filled programmatically -->

</PreferenceScreen>
+7 −0
Original line number Diff line number Diff line
@@ -42,6 +42,13 @@ public class BackupSettingsFragment extends DashboardFragment {
        super.onCreate(savedInstanceState);
    }

    @Override
    public void onStart() {
        super.onStart();
        // update information when we navigate back from TransportActivity
        displayResourceTilesToScreen(getPreferenceScreen());
    }

    /**
     * Get the tag string for logging.
     */
+7 −7
Original line number Diff line number Diff line
@@ -30,24 +30,24 @@ public class BackupSettingsPreferenceController extends AbstractPreferenceContro
        implements PreferenceControllerMixin {
    private static final String BACKUP_SETTINGS = "backup_settings";
    private static final  String MANUFACTURER_SETTINGS = "manufacturer_backup";
    private Intent mBackupSettingsIntent;
    private CharSequence mBackupSettingsTitle;
    private String mBackupSettingsSummary;
    private final BackupSettingsHelper settingsHelper;
    private Intent mManufacturerIntent;
    private String mManufacturerLabel;

    public BackupSettingsPreferenceController(Context context) {
        super(context);
        BackupSettingsHelper settingsHelper = new BackupSettingsHelper(context);
        mBackupSettingsIntent = settingsHelper.getIntentForBackupSettings();
        mBackupSettingsTitle = settingsHelper.getLabelForBackupSettings();
        mBackupSettingsSummary = settingsHelper.getSummaryForBackupSettings();
        settingsHelper = new BackupSettingsHelper(context);
        mManufacturerIntent = settingsHelper.getIntentProvidedByManufacturer();
        mManufacturerLabel = settingsHelper.getLabelProvidedByManufacturer();
    }

    @Override
    public void displayPreference(PreferenceScreen screen) {
        // we don't get these in the constructor, so we can get updates for them later
        Intent mBackupSettingsIntent = settingsHelper.getIntentForBackupSettings();
        CharSequence mBackupSettingsTitle = settingsHelper.getLabelForBackupSettings();
        String mBackupSettingsSummary = settingsHelper.getSummaryForBackupSettings();

        Preference backupSettings = screen.findPreference(BACKUP_SETTINGS);
        Preference manufacturerSettings = screen.findPreference(MANUFACTURER_SETTINGS);
        backupSettings.setIntent(mBackupSettingsIntent);
Loading