1 /* 2 * Copyright (C) 2023 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.server.locales; 18 19 import static android.os.Process.INVALID_UID; 20 21 import com.android.internal.util.FrameworkStatsLog; 22 23 /** 24 * Holds data used to report the AppSupportedLocalesChanged atom. 25 */ 26 public final class AppSupportedLocalesChangedAtomRecord { 27 // The uid which invoked this update. 28 final int mCallingUid; 29 // The uid for which the override of app’s supported locales change is being done. 30 int mTargetUid = INVALID_UID; 31 // The total number of locales in the override LocaleConfig. 32 int mNumLocales = -1; 33 // Whether the override is removed LocaleConfig from the storage. 34 boolean mOverrideRemoved = false; 35 // Whether the new override LocaleConfig is the same as the app’s LocaleConfig. 36 boolean mSameAsResConfig = false; 37 // Whether the new override LocaleConfig is the same as the previously effective one. This means 38 // a comparison with the previous override LocaleConfig if there was one, and a comparison with 39 // the resource LocaleConfig if no override was present. 40 boolean mSameAsPrevConfig = false; 41 // Application supported locales changed status. 42 int mStatus = FrameworkStatsLog 43 .APP_SUPPORTED_LOCALES_CHANGED__STATUS__STATUS_UNSPECIFIED; 44 AppSupportedLocalesChangedAtomRecord(int callingUid)45 AppSupportedLocalesChangedAtomRecord(int callingUid) { 46 this.mCallingUid = callingUid; 47 } 48 setTargetUid(int targetUid)49 void setTargetUid(int targetUid) { 50 this.mTargetUid = targetUid; 51 } 52 setNumLocales(int numLocales)53 void setNumLocales(int numLocales) { 54 this.mNumLocales = numLocales; 55 } 56 setOverrideRemoved(boolean overrideRemoved)57 void setOverrideRemoved(boolean overrideRemoved) { 58 this.mOverrideRemoved = overrideRemoved; 59 } 60 setSameAsResConfig(boolean sameAsResConfig)61 void setSameAsResConfig(boolean sameAsResConfig) { 62 this.mSameAsResConfig = sameAsResConfig; 63 } 64 setSameAsPrevConfig(boolean sameAsPrevConfig)65 void setSameAsPrevConfig(boolean sameAsPrevConfig) { 66 this.mSameAsPrevConfig = sameAsPrevConfig; 67 } 68 setStatus(int status)69 void setStatus(int status) { 70 this.mStatus = status; 71 } 72 } 73