• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.settings;
18 
19 import android.app.Activity;
20 import android.content.Intent;
21 import android.os.Bundle;
22 import android.text.TextUtils;
23 import android.util.Log;
24 
25 import com.android.settings.R;
26 
27 import java.net.URISyntaxException;
28 
29 /**
30  * A trampoline activity used to launch the configured Backup activity.
31  * This activity used the theme NoDisplay to minimize the flicker that might be seen for the launch-
32  * finsih transition.
33  */
34 public class BackupSettingsActivity extends Activity {
35     private static final String TAG = "BackupSettingsActivity";
36 
37     @Override
onCreate(Bundle savedInstanceState)38     public void onCreate(Bundle savedInstanceState) {
39         super.onCreate(savedInstanceState);
40         String backup = getResources().getString(R.string.config_backup_settings_intent);
41         if (!TextUtils.isEmpty(backup)) {
42             try {
43                 Intent intent = Intent.parseUri(backup, 0);
44                 if (intent.resolveActivity(getPackageManager()) != null) {
45                     // use startActivityForResult to let the activity check the caller signature
46                     startActivityForResult(intent, -1);
47                 } else {
48                     Log.e(TAG, "Backup component not found!");
49                 }
50             } catch (URISyntaxException e) {
51                 Log.e(TAG, "Invalid backup component URI!", e);
52             }
53         }
54         finish();
55     }
56 }