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-keep class * extends android.app.Service 16# Keep the Icing proto methods that are necessary for string formatting since MessageLiteToString 17# uses reflection (setters, getters, and hassers) 18# 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 19# The keepclassmembers rule below ignores the Icing proto classes that end in Builder (OrBuilder and 20# nested Builder classes) and matches all other Icing proto classes. The rule does not keep members 21# of classes that are not used. 22-keepclassmembers class !com.android.server.appsearch.icing.proto.*Builder, 23 com.android.server.appsearch.icing.proto.* { 24# We specify rules for primitive (%), String, and Icing proto types individually in order to exclude 25# ByteString methods for strings e.g. setNamespaceBytes or getNamespaceBytes. Proguard does not have 26# rules for excluding members, so this is the best we can do. 27 void set*(%); 28 void set*(java.lang.String); 29 void set*(com.android.server.appsearch.icing.proto.*); 30 % get*(); 31 java.lang.String get*(); 32 java.util.List get*(); 33 com.android.server.appsearch.icing.proto.* get*(); 34 boolean has*(); 35} 36 37# This prevents the obfuscation or removal of fields referenced in native. 38-keep class com.google.android.icing.IcingSearchEngineImpl 39-keepclassmembers public class com.google.android.icing.IcingSearchEngineImpl { 40 private long nativePointer; 41 native <methods>; 42} 43