1# Copyright (C) 2022 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15# TODO(b/373579455): Evaluate if <init> needs to be kept. 16-keep class * extends android.app.Service { 17 void <init>(); 18} 19# Keep the Icing proto methods that are necessary for string formatting since MessageLiteToString 20# uses reflection (setters, getters, and hassers) 21# https://cs.android.com/android/platform/superproject/main/+/main:external/protobuf/java/core/src/main/java/com/google/protobuf/MessageLiteToString.java;l=82;drc=0ccbdeff847ae5390ba6632a67f6b5d2ab8632c1 22# The keepclassmembers rule below ignores the Icing proto classes that end in Builder (OrBuilder and 23# nested Builder classes) and matches all other Icing proto classes. The rule does not keep members 24# of classes that are not used. 25-keepclassmembers class !com.android.server.appsearch.icing.proto.*Builder, 26 com.android.server.appsearch.icing.proto.* { 27# We specify rules for primitive (%), String, and Icing proto types individually in order to exclude 28# ByteString methods for strings e.g. setNamespaceBytes or getNamespaceBytes. Proguard does not have 29# rules for excluding members, so this is the best we can do. 30 void set*(%); 31 void set*(java.lang.String); 32 void set*(com.android.server.appsearch.icing.proto.*); 33 % get*(); 34 java.lang.String get*(); 35 java.util.List get*(); 36 com.android.server.appsearch.icing.proto.* get*(); 37 boolean has*(); 38} 39 40# This prevents the obfuscation or removal of fields referenced in native. 41# TODO(b/373579455): Evaluate if <init> needs to be kept. 42-keep class com.google.android.icing.IcingSearchEngineImpl { 43 void <init>(); 44} 45-keepclassmembers public class com.google.android.icing.IcingSearchEngineImpl { 46 private long nativePointer; 47 native <methods>; 48} 49