1 /* 2 * Copyright (C) 2022 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.ons; 18 19 import com.android.ons.ONSProfileActivator.Result; 20 import com.android.ons.ONSProfileDownloader.DownloadRetryResultCode; 21 22 public final class ONSStatsInfo { 23 public static final int INVALID_VALUE = -1; 24 private Result mProvisioningResult = null; 25 private DownloadRetryResultCode mDownloadResult = null; 26 private int mPrimarySimSubId = INVALID_VALUE; 27 private int mOppSimCarrierId = INVALID_VALUE; 28 private int mRetryCount = INVALID_VALUE; 29 private int mDetailedErrCode = INVALID_VALUE; 30 private boolean mIsWifiConnected = false; 31 private boolean mIsProvisioningResultUpdated = false; 32 getProvisioningResult()33 public Result getProvisioningResult() { 34 return mProvisioningResult; 35 } 36 getDownloadResult()37 public DownloadRetryResultCode getDownloadResult() { 38 return mDownloadResult; 39 } 40 getPrimarySimSubId()41 public int getPrimarySimSubId() { 42 return mPrimarySimSubId; 43 } 44 getOppSimCarrierId()45 public int getOppSimCarrierId() { 46 return mOppSimCarrierId; 47 } 48 getRetryCount()49 public int getRetryCount() { 50 return mRetryCount; 51 } 52 getDetailedErrCode()53 public int getDetailedErrCode() { 54 return mDetailedErrCode; 55 } 56 isWifiConnected()57 public boolean isWifiConnected() { 58 return mIsWifiConnected; 59 } 60 isProvisioningResultUpdated()61 public boolean isProvisioningResultUpdated() { 62 return mIsProvisioningResultUpdated; 63 } 64 setProvisioningResult(Result result)65 public ONSStatsInfo setProvisioningResult(Result result) { 66 mProvisioningResult = result; 67 mDownloadResult = null; 68 mIsProvisioningResultUpdated = true; 69 return this; 70 } 71 setDownloadResult(DownloadRetryResultCode retryResultCode)72 public ONSStatsInfo setDownloadResult(DownloadRetryResultCode retryResultCode) { 73 mProvisioningResult = null; 74 mDownloadResult = retryResultCode; 75 mIsProvisioningResultUpdated = false; 76 return this; 77 } 78 setPrimarySimSubId(int primarySimSubId)79 public ONSStatsInfo setPrimarySimSubId(int primarySimSubId) { 80 mPrimarySimSubId = primarySimSubId; 81 return this; 82 } 83 setOppSimCarrierId(int oppSimCarrierId)84 public ONSStatsInfo setOppSimCarrierId(int oppSimCarrierId) { 85 mOppSimCarrierId = oppSimCarrierId; 86 return this; 87 } 88 setRetryCount(int retryCount)89 public ONSStatsInfo setRetryCount(int retryCount) { 90 mRetryCount = retryCount; 91 return this; 92 } 93 setDetailedErrCode(int detailedErrCode)94 public ONSStatsInfo setDetailedErrCode(int detailedErrCode) { 95 mDetailedErrCode = detailedErrCode; 96 return this; 97 } 98 setWifiConnected(boolean wifiConnected)99 public ONSStatsInfo setWifiConnected(boolean wifiConnected) { 100 mIsWifiConnected = wifiConnected; 101 return this; 102 } 103 104 @Override toString()105 public String toString() { 106 return "ONSStatsInfo{" 107 + "mProvisioningResult=" 108 + mProvisioningResult 109 + ", mDownloadResult=" 110 + mDownloadResult 111 + ", mPrimarySimSubId=" 112 + mPrimarySimSubId 113 + ", mOppSimCarrierId=" 114 + mOppSimCarrierId 115 + ", mRetryCount=" 116 + mRetryCount 117 + ", mDetailedErrCode=" 118 + mDetailedErrCode 119 + ", mIsWifiConnected=" 120 + mIsWifiConnected 121 + ", mIsProvisioningResultUpdated=" 122 + mIsProvisioningResultUpdated 123 + '}'; 124 } 125 } 126