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.car.settings.common; 18 19 import android.os.Build; 20 import android.util.Log; 21 22 import com.android.car.settings.CarSettingsStatsLog; 23 24 25 /** 26 * Helper class that directly interacts with {@link CarSettingsStatsLog}, a generated class that 27 * contains logging methods for MobileDataRow and MobileNetworkEntryPreferenceController. 28 */ 29 public class DataSubscriptionStatsLogHelper { 30 private static final String TAG = DataSubscriptionStatsLogHelper.class.getSimpleName(); 31 private static DataSubscriptionStatsLogHelper sInstance; 32 33 /** 34 * Returns the current logging instance of DataSubscriptionStatsLogHelper to write this devices' 35 * CarSettingsStatsLog. 36 * 37 * @return the logging instance of DataSubscriptionStatsLogHelper. 38 */ getInstance()39 public static DataSubscriptionStatsLogHelper getInstance() { 40 if (sInstance == null) { 41 sInstance = new DataSubscriptionStatsLogHelper(); 42 } 43 return sInstance; 44 } 45 46 /** 47 * Writes to CarSettingsDataSubscriptionEventReported atom with {@code launchType} 48 * as the only field, 49 * 50 */ writeDataSubscriptionEventReported()51 public void writeDataSubscriptionEventReported() { 52 if (Build.isDebuggable()) { 53 Log.v(TAG, "writing CAR_SETTINGS_DATA_SUBSCRIPTION_EVENT_REPORTED."); 54 } 55 CarSettingsStatsLog.write( 56 /* atomId */ CarSettingsStatsLog.CAR_SETTINGS_DATA_SUBSCRIPTION_EVENT_REPORTED); 57 } 58 } 59