Home | History | Annotate | Download | only in backup
      1 /*
      2  * Copyright (C) 2018 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.internal.backup;
     18 
     19 import android.util.KeyValueSettingObserver;
     20 import android.content.ContentResolver;
     21 import android.os.Handler;
     22 import android.provider.Settings;
     23 import android.util.KeyValueListParser;
     24 
     25 class LocalTransportParameters extends KeyValueSettingObserver {
     26     private static final String TAG = "LocalTransportParams";
     27     private static final String SETTING = Settings.Secure.BACKUP_LOCAL_TRANSPORT_PARAMETERS;
     28     private static final String KEY_FAKE_ENCRYPTION_FLAG = "fake_encryption_flag";
     29     private static final String KEY_NON_INCREMENTAL_ONLY = "non_incremental_only";
     30 
     31     private boolean mFakeEncryptionFlag;
     32     private boolean mIsNonIncrementalOnly;
     33 
     34     LocalTransportParameters(Handler handler, ContentResolver resolver) {
     35         super(handler, resolver, Settings.Secure.getUriFor(SETTING));
     36     }
     37 
     38     boolean isFakeEncryptionFlag() {
     39         return mFakeEncryptionFlag;
     40     }
     41 
     42     boolean isNonIncrementalOnly() {
     43         return mIsNonIncrementalOnly;
     44     }
     45 
     46     public String getSettingValue(ContentResolver resolver) {
     47         return Settings.Secure.getString(resolver, SETTING);
     48     }
     49 
     50     public void update(KeyValueListParser parser) {
     51         mFakeEncryptionFlag = parser.getBoolean(KEY_FAKE_ENCRYPTION_FLAG, false);
     52         mIsNonIncrementalOnly = parser.getBoolean(KEY_NON_INCREMENTAL_ONLY, false);
     53     }
     54 }
     55