1 /************************************************************************************ 2 * 3 * Copyright (C) 2009-2012 Broadcom Corporation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ************************************************************************************/ 18 package com.android.bluetooth.pbap; 19 20 import android.content.Context; 21 import android.content.res.Resources; 22 import android.util.Log; 23 24 import com.android.bluetooth.R; 25 import com.android.internal.annotations.VisibleForTesting; 26 27 public class BluetoothPbapConfig { 28 private static boolean sUseProfileForOwnerVcard = true; 29 private static boolean sIncludePhotosInVcard = false; 30 init(Context ctx)31 public static void init(Context ctx) { 32 Resources r = ctx.getResources(); 33 if (r != null) { 34 try { 35 sUseProfileForOwnerVcard = r.getBoolean(R.bool.pbap_use_profile_for_owner_vcard); 36 } catch (Exception e) { 37 Log.e("BluetoothPbapConfig", "", e); 38 } 39 try { 40 sIncludePhotosInVcard = r.getBoolean(R.bool.pbap_include_photos_in_vcard); 41 } catch (Exception e) { 42 Log.e("BluetoothPbapConfig", "", e); 43 } 44 } 45 } 46 47 /** 48 * If true, owner vcard will be generated from the "Me" profile 49 */ useProfileForOwnerVcard()50 public static boolean useProfileForOwnerVcard() { 51 return sUseProfileForOwnerVcard; 52 } 53 54 /** 55 * If true, include photos in contact information returned to PCE 56 * @return 57 */ includePhotosInVcard()58 public static boolean includePhotosInVcard() { 59 return sIncludePhotosInVcard; 60 } 61 62 @VisibleForTesting setIncludePhotosInVcard(boolean includePhotosInVcard)63 public static void setIncludePhotosInVcard(boolean includePhotosInVcard) { 64 sIncludePhotosInVcard = includePhotosInVcard; 65 } 66 } 67