1 /* 2 * Copyright (C) 2014 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 android.content.res; 18 19 import com.android.tools.layoutlib.annotations.LayoutlibDelegate; 20 21 import android.util.SparseArray; 22 23 /** 24 * Delegate used to provide implementation of a select few native methods of {@link AssetManager} 25 * <p/> 26 * Through the layoutlib_create tool, the original native methods of AssetManager have been replaced 27 * by calls to methods of the same name in this delegate class. 28 * 29 */ 30 public class AssetManager_Delegate { 31 32 @LayoutlibDelegate newTheme(AssetManager manager)33 /*package*/ static long newTheme(AssetManager manager) { 34 return Resources_Theme_Delegate.getDelegateManager() 35 .addNewDelegate(new Resources_Theme_Delegate()); 36 } 37 38 @LayoutlibDelegate deleteTheme(AssetManager manager, long theme)39 /*package*/ static void deleteTheme(AssetManager manager, long theme) { 40 Resources_Theme_Delegate.getDelegateManager().removeJavaReferenceFor(theme); 41 } 42 43 @LayoutlibDelegate getAssignedPackageIdentifiers(AssetManager manager)44 /*package*/ static SparseArray<String> getAssignedPackageIdentifiers(AssetManager manager) { 45 return new SparseArray<>(); 46 } 47 } 48