• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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.providers.settings;
18 
19 import static com.android.providers.settings.SettingsProvider.TABLE_CONFIG;
20 import static com.android.providers.settings.SettingsProvider.TABLE_GLOBAL;
21 import static com.android.providers.settings.SettingsProvider.TABLE_SECURE;
22 import static com.android.providers.settings.SettingsProvider.TABLE_SSAID;
23 import static com.android.providers.settings.SettingsProvider.TABLE_SYSTEM;
24 import static com.android.providers.settings.SettingsProvider.WRITE_FALLBACK_SETTINGS_FILES_JOB_ID;
25 
26 import android.app.job.JobParameters;
27 import android.app.job.JobService;
28 
29 import java.util.ArrayList;
30 import java.util.List;
31 
32 /**
33  * JobService to make a copy of a list of files, given their paths.
34  */
35 public class WriteFallbackSettingsFilesJobService extends JobService {
36     @Override
onStartJob(final JobParameters params)37     public boolean onStartJob(final JobParameters params) {
38         if (params.getJobId() != WRITE_FALLBACK_SETTINGS_FILES_JOB_ID) {
39             return false;
40         }
41         final List<String> settingsFiles = new ArrayList<>();
42         settingsFiles.add(params.getExtras().getString(TABLE_GLOBAL, ""));
43         settingsFiles.add(params.getExtras().getString(TABLE_SYSTEM, ""));
44         settingsFiles.add(params.getExtras().getString(TABLE_SECURE, ""));
45         settingsFiles.add(params.getExtras().getString(TABLE_SSAID, ""));
46         settingsFiles.add(params.getExtras().getString(TABLE_CONFIG, ""));
47         SettingsProvider.writeFallBackSettingsFiles(settingsFiles);
48         return false;
49     }
50 
51     @Override
onStopJob(JobParameters params)52     public boolean onStopJob(JobParameters params) {
53         return false;
54     }
55 
56 }
57