Remove unneeded init & displayPreference functions
Bug: 330336498 Test: m & atest CellularSecurityNotificationsDividerControllerTest CellularSecurityNotificationsPreferenceControllerTest CellularSecurityEncryptionDividerControllerTest CellularSecurityPreferenceControllerTest Flag: EXEMPT bugfix Change-Id: I791ad88738da24916b2c48e9b24f404707fc7047
This commit is contained in:
@@ -21,7 +21,6 @@ import android.telephony.TelephonyManager;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.preference.PreferenceScreen;
|
|
||||||
|
|
||||||
import com.android.internal.telephony.flags.FeatureFlags;
|
import com.android.internal.telephony.flags.FeatureFlags;
|
||||||
import com.android.internal.telephony.flags.FeatureFlagsImpl;
|
import com.android.internal.telephony.flags.FeatureFlagsImpl;
|
||||||
@@ -52,26 +51,11 @@ public class CellularSecurityEncryptionDividerController extends
|
|||||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
|
mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialization.
|
|
||||||
*/
|
|
||||||
public CellularSecurityEncryptionDividerController init() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayPreference(@NonNull PreferenceScreen screen) {
|
|
||||||
super.displayPreference(screen);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
if (mTelephonyManager == null) {
|
if (mTelephonyManager == null) {
|
||||||
Log.w(LOG_TAG,
|
Log.w(LOG_TAG, "Telephony manager not yet initialized.");
|
||||||
"Telephony manager not yet initialized. Marking availability as "
|
|
||||||
+ "CONDITIONALLY_UNAVAILABLE");
|
|
||||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
|
mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
|
||||||
return CONDITIONALLY_UNAVAILABLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import android.util.Log;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.PreferenceScreen;
|
|
||||||
|
|
||||||
import com.android.internal.telephony.flags.Flags;
|
import com.android.internal.telephony.flags.Flags;
|
||||||
import com.android.settings.core.BasePreferenceController;
|
import com.android.settings.core.BasePreferenceController;
|
||||||
@@ -55,18 +54,6 @@ public class CellularSecurityNotificationsDividerController extends
|
|||||||
mSafetyCenterManager = mContext.getSystemService(SafetyCenterManager.class);
|
mSafetyCenterManager = mContext.getSystemService(SafetyCenterManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialization.
|
|
||||||
*/
|
|
||||||
public CellularSecurityNotificationsDividerController init() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayPreference(@NonNull PreferenceScreen screen) {
|
|
||||||
super.displayPreference(screen);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
if (!Flags.enableIdentifierDisclosureTransparencyUnsolEvents()
|
if (!Flags.enableIdentifierDisclosureTransparencyUnsolEvents()
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import android.util.Log;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.PreferenceScreen;
|
|
||||||
|
|
||||||
import com.android.internal.telephony.flags.Flags;
|
import com.android.internal.telephony.flags.Flags;
|
||||||
|
|
||||||
@@ -60,17 +59,12 @@ public class CellularSecurityNotificationsPreferenceController extends
|
|||||||
* @param subId is the subscription id
|
* @param subId is the subscription id
|
||||||
* @return this instance after initialization
|
* @return this instance after initialization
|
||||||
*/
|
*/
|
||||||
public CellularSecurityNotificationsPreferenceController init(@NonNull int subId) {
|
@NonNull public CellularSecurityNotificationsPreferenceController init(@NonNull int subId) {
|
||||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
|
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
|
||||||
.createForSubscriptionId(subId);
|
.createForSubscriptionId(subId);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayPreference(@NonNull PreferenceScreen screen) {
|
|
||||||
super.displayPreference(screen);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus(int subId) {
|
public int getAvailabilityStatus(int subId) {
|
||||||
if (!isSafetyCenterSupported()) {
|
if (!isSafetyCenterSupported()) {
|
||||||
@@ -80,10 +74,6 @@ public class CellularSecurityNotificationsPreferenceController extends
|
|||||||
if (!areFlagsEnabled()) {
|
if (!areFlagsEnabled()) {
|
||||||
return UNSUPPORTED_ON_DEVICE;
|
return UNSUPPORTED_ON_DEVICE;
|
||||||
}
|
}
|
||||||
if (mTelephonyManager == null) {
|
|
||||||
Log.w(LOG_TAG, "Telephony manager not yet initialized");
|
|
||||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checking for hardware support, i.e. IRadio AIDL version must be >= 2.2
|
// Checking for hardware support, i.e. IRadio AIDL version must be >= 2.2
|
||||||
try {
|
try {
|
||||||
@@ -168,6 +158,10 @@ public class CellularSecurityNotificationsPreferenceController extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean areNotificationsEnabled() {
|
private boolean areNotificationsEnabled() {
|
||||||
|
if (mTelephonyManager == null) {
|
||||||
|
Log.w(LOG_TAG, "Telephony manager not yet initialized");
|
||||||
|
mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
|
||||||
|
}
|
||||||
return mTelephonyManager.isNullCipherNotificationsEnabled()
|
return mTelephonyManager.isNullCipherNotificationsEnabled()
|
||||||
&& mTelephonyManager.isCellularIdentifierDisclosureNotificationsEnabled();
|
&& mTelephonyManager.isCellularIdentifierDisclosureNotificationsEnabled();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user