Add a screen to show OEM backup settings.
Moves the backup settings logic to BackupSettingsHelper and BackupSettingsActivity: - If the manufacturer provides the intent and the label for their backup settings in the config.xml, a new intermediate fragment is shown for Backup settings to let the user pick either standard backup settings or OEM provided backup settings. - If config.xml doesn't contain the intent, BackupSettingsActivity is used as a trampoline activity to launch backup settings provided by the backup transport of the default backup settings activity, i.e. PrivacySettingsActivity. Bug: 34700410 Bug: 33655074 Bug: 33654991 Test: make RunSettingsRoboTests Change-Id: I78e340fbf926b2a9dc2c4e3942f9337c3c7a933c
This commit is contained in:
56
src/com/android/settings/backup/BackupSettingsActivity.java
Normal file
56
src/com/android/settings/backup/BackupSettingsActivity.java
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source 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
|
||||
*/
|
||||
|
||||
package com.android.settings.backup;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
/**
|
||||
* The activity used to launch the configured Backup activity or the preference screen
|
||||
* if the manufacturer provided their backup settings.
|
||||
*/
|
||||
public class BackupSettingsActivity extends Activity {
|
||||
private static final String TAG = "BackupSettingsActivity";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
BackupSettingsHelper backupHelper = new BackupSettingsHelper(this);
|
||||
|
||||
if (!backupHelper.isBackupProvidedByManufacturer()) {
|
||||
// If manufacturer specific backup settings are not provided then launch
|
||||
// the backup settings provided by backup transport or the default one directly.
|
||||
if (Log.isLoggable(TAG, Log.DEBUG)) {
|
||||
Log.d(TAG,
|
||||
"No manufacturer settings found, launching the backup settings directly");
|
||||
}
|
||||
// use startActivityForResult to let the activity check the caller signature
|
||||
startActivityForResult(backupHelper.getIntentForBackupSettings(), 1);
|
||||
finish();
|
||||
} else {
|
||||
if (Log.isLoggable(TAG, Log.DEBUG)) {
|
||||
Log.d(TAG, "Manufacturer provided backup settings, showing the preference screen");
|
||||
}
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(android.R.id.content, new BackupSettingsFragment())
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user