1 /*
2  * Copyright (C) 2017 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.dialer.constants;
18 
19 import android.content.Context;
20 import android.content.pm.PackageManager;
21 import android.os.Build;
22 import android.support.annotation.NonNull;
23 import com.android.dialer.proguard.UsedByReflection;
24 
25 /** Provider config values for Google Dialer. */
26 @UsedByReflection(value = "Constants.java")
27 public class ConstantsImpl extends Constants {
28 
29   @Override
30   @NonNull
getFilteredNumberProviderAuthority()31   public String getFilteredNumberProviderAuthority() {
32     return "com.google.android.dialer.blocking.filterednumberprovider";
33   }
34 
35   @Override
36   @NonNull
getFileProviderAuthority()37   public String getFileProviderAuthority() {
38     return "com.google.android.dialer.files";
39   }
40 
41   @NonNull
42   @Override
getAnnotatedCallLogProviderAuthority()43   public String getAnnotatedCallLogProviderAuthority() {
44     return "com.google.android.dialer.annotatedcalllog";
45   }
46 
47   @NonNull
48   @Override
getPhoneLookupHistoryProviderAuthority()49   public String getPhoneLookupHistoryProviderAuthority() {
50     return "com.google.android.dialer.phonelookuphistory";
51   }
52 
53   @NonNull
54   @Override
getPreferredSimFallbackProviderAuthority()55   public String getPreferredSimFallbackProviderAuthority() {
56     return "com.google.android.dialer.preferredsimfallback";
57   }
58 
59   @Override
getUserAgent(Context context)60   public String getUserAgent(Context context) {
61     StringBuilder userAgent = new StringBuilder("GoogleDialer ");
62     try {
63       String versionName =
64           context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
65       userAgent.append(versionName).append(" ");
66     } catch (PackageManager.NameNotFoundException e) {
67       // ignore
68     }
69     userAgent.append(Build.FINGERPRINT);
70 
71     return userAgent.toString();
72   }
73 
74   @NonNull
75   @Override
getSettingsActivity()76   public String getSettingsActivity() {
77     return "com.google.android.apps.dialer.settings.GoogleDialerSettingsActivity";
78   }
79 }
80