1 /* 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 package com.android.server.usage; 17 18 import android.annotation.NonNull; 19 import android.annotation.UserIdInt; 20 import android.content.pm.PackageStats; 21 22 /** 23 * StorageStatsManager local system service interface. 24 * 25 * Only for use within the system server. 26 */ 27 public abstract class StorageStatsManagerInternal { 28 /** 29 * Class used to augment {@link PackageStats} with the data stored by the system on 30 * behalf of apps in system specific directories 31 * ({@link android.os.Environment#getDataSystemDirectory}, 32 * {@link android.os.Environment#getDataSystemCeDirectory}, etc). 33 */ 34 public interface StorageStatsAugmenter { augmentStatsForPackage(@onNull PackageStats stats, @NonNull String packageName, @UserIdInt int userId, boolean callerHasStatsPermission)35 void augmentStatsForPackage(@NonNull PackageStats stats, 36 @NonNull String packageName, @UserIdInt int userId, 37 boolean callerHasStatsPermission); augmentStatsForUid(@onNull PackageStats stats, int uid, boolean callerHasStatsPermission)38 void augmentStatsForUid(@NonNull PackageStats stats, int uid, 39 boolean callerHasStatsPermission); 40 } 41 42 /** 43 * Register a {@link StorageStatsAugmenter}. 44 * 45 * @param augmenter the {@link StorageStatsAugmenter} object to be registered. 46 * @param tag the identifier to be used for debugging in logs/trace. 47 */ registerStorageStatsAugmenter(@onNull StorageStatsAugmenter augmenter, @NonNull String tag)48 public abstract void registerStorageStatsAugmenter(@NonNull StorageStatsAugmenter augmenter, 49 @NonNull String tag); 50 } 51