1 /* 2 * Copyright 2022 Google LLC 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.google.android.libraries.mobiledatadownload.internal; 17 18 import android.content.Context; 19 20 /** Common MDD Constants */ 21 public class MddConstants { 22 23 // The gms app package name. 24 public static final String GMS_PACKAGE = "com.google.android.gms"; 25 26 // MDD Phenotype base package name. 27 private static final String BASE_CONFIG_PACKAGE_NAME = "com.google.android.gms.icing.mdd"; 28 29 // The mdd package name. This is also the mdd phenotype package name. 30 // TODO: Replace usage with getPhenotypeConfigPackageName. 31 public static final String CONFIG_PACKAGE_NAME = "com.google.android.gms.icing.mdd"; 32 33 /** Returns the ph package name that the host app should register with on behalf of MDD. */ getPhenotypeConfigPackageName(Context context)34 public static String getPhenotypeConfigPackageName(Context context) { 35 if (context.getPackageName().equals(GMS_PACKAGE)) { 36 return BASE_CONFIG_PACKAGE_NAME; 37 } else { 38 return BASE_CONFIG_PACKAGE_NAME + "#" + context.getPackageName(); 39 } 40 } 41 42 /** Icing-specific constants. Source of truth is the corresponding Icing files. * */ 43 // The Icing log source name from here: 44 // <internal> 45 // LINT.IfChange 46 public static final String ICING_LOG_SOURCE_NAME = "ICING"; 47 // LINT.ThenChange(<internal>) 48 49 public static final String MDD_GCM_TASK_SERVICE_PROXY_CLASS_NAME = 50 "com.google.android.gms.mdi.download.service.MddGcmTaskService"; 51 52 public static final String SPLIT_CHAR = "|"; 53 54 /** The custom URL scheme used by MDD to identify inline files. */ 55 public static final String INLINE_FILE_URL_SCHEME = "inlinefile"; 56 57 /** URL schemes used for sideloaded files. */ 58 public static final String SIDELOAD_FILE_URL_SCHEME = "file"; 59 60 public static final String EMBEDDED_ASSET_URL_SCHEME = "asset"; 61 62 /** 63 * Currently used in getFileGroup logging. If a matching file group is not found, build_id and 64 * file_group_version_number are set to below values for logging. 65 */ 66 public static final int FILE_GROUP_NOT_FOUND_BUILD_ID = -1; 67 68 public static final int FILE_GROUP_NOT_FOUND_FILE_GROUP_VERSION_NUMBER = -1; 69 } 70