1 /* 2 * Copyright (C) 2024 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.adservices.data.customaudience; 18 19 import android.adservices.common.AdData; 20 import android.adservices.common.AdFilters; 21 import android.adservices.common.AppInstallFilters; 22 23 import com.android.adservices.data.common.DBAdData; 24 25 import org.json.JSONException; 26 import org.json.JSONObject; 27 28 /** Strategy for doing optional feature-flagged parts of the app install filters conversion */ 29 public interface AppInstallFiltersConversionStrategy { 30 31 /** 32 * Fills a part of the given {@link JSONObject} with the data from {@link 33 * AdFilters#getAppInstallFilters()} ()}. 34 */ toJson(AppInstallFilters appInstallFilters, JSONObject toReturn)35 void toJson(AppInstallFilters appInstallFilters, JSONObject toReturn) throws JSONException; 36 37 /** Deserialize {@link AppInstallFilters} from {@link JSONObject}. */ fromJson(JSONObject json, AdFilters.Builder builder)38 void fromJson(JSONObject json, AdFilters.Builder builder) throws JSONException; 39 40 /** 41 * Parse part of parcelable {@link AdData} to storage model {@link DBAdData} with the data from 42 * {@link AdFilters#getAppInstallFilters()} 43 */ fromServiceObject(AdData parcelable, AdFilters.Builder builder)44 void fromServiceObject(AdData parcelable, AdFilters.Builder builder); 45 } 46