blob: bbfea7cf3f887b74b48c13e95cfa80061f32dfac [file] [log] [blame]
Rico Winda6e4efc2023-08-03 07:51:44 +02001/*
2 * Copyright (C) 2020 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
17package com.android.build.shrinker.usages
18
19import com.android.build.shrinker.obfuscation.ObfuscatedClasses
20
21internal object AppCompat {
22 // Known AppCompat classes which use Resources.getIdentifier but should not trigger mode that
23 // tries to find used resources based on collected strings.
24 internal val APP_COMPAT_CLASSES_ALLOWED_FOR_GET_IDENTIFIER = setOf(
25 "android.support.v7.widget.SuggestionsAdapter",
26 "android.support.v7.internal.widget.ResourcesWrapper",
27 "android.support.v7.widget.ResourcesWrapper",
28 "android.support.v7.widget.TintContextWrapper\$TintResources"
29 )
30
31 internal fun isAppCompatClass(name: String, obfuscation: ObfuscatedClasses): Boolean =
32 APP_COMPAT_CLASSES_ALLOWED_FOR_GET_IDENTIFIER.contains(obfuscation.resolveOriginalClass(name))
33}