Home | History | Annotate | Download | only in vvm
      1 /*
      2  * Copyright (C) 2015 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 package com.android.phone.vvm;
     17 
     18 import android.content.Context;
     19 import android.os.Bundle;
     20 import android.telecom.PhoneAccountHandle;
     21 import android.telephony.TelephonyManager;
     22 
     23 /**
     24  * Save whether or not a particular account is enabled in shared to be retrieved later.
     25  */
     26 public class VisualVoicemailSettingsUtil {
     27 
     28     private static final String IS_ENABLED_KEY = "is_enabled";
     29 
     30     private static final String DEFAULT_OLD_PIN_KEY = "default_old_pin";
     31 
     32     public static Bundle dump(Context context, PhoneAccountHandle phoneAccountHandle){
     33         Bundle result = new Bundle();
     34         VisualVoicemailPreferences prefs = new VisualVoicemailPreferences(context,
     35                 phoneAccountHandle);
     36         if (prefs.contains(IS_ENABLED_KEY)) {
     37             result.putBoolean(TelephonyManager.EXTRA_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL,
     38                     prefs.getBoolean(IS_ENABLED_KEY, false));
     39         }
     40         result.putString(TelephonyManager.EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING,
     41                 prefs.getString(DEFAULT_OLD_PIN_KEY));
     42         return result;
     43     }
     44 }
     45