Apply java-format on AirplaneModeListener
Bug: 262605980
Test: None | no-op change
Test: atest ServiceBluetoothTests
Change-Id: I668d8c3111c32fccb3496650d5583305e4221610
diff --git a/service/src/com/android/server/bluetooth/BluetoothAirplaneModeListener.java b/service/src/com/android/server/bluetooth/BluetoothAirplaneModeListener.java
index 3fda9be..60f0219 100644
--- a/service/src/com/android/server/bluetooth/BluetoothAirplaneModeListener.java
+++ b/service/src/com/android/server/bluetooth/BluetoothAirplaneModeListener.java
@@ -32,16 +32,19 @@
import com.android.internal.annotations.VisibleForTesting;
/**
- * The BluetoothAirplaneModeListener handles system airplane mode change callback and checks
- * whether we need to inform BluetoothManagerService on this change.
+ * The BluetoothAirplaneModeListener handles system airplane mode change callback and checks whether
+ * we need to inform BluetoothManagerService on this change.
*
- * The information of airplane mode turns on would not be passed to the BluetoothManagerService
+ * <p>The information of airplane mode turns on would not be passed to the BluetoothManagerService
* when Bluetooth is on and Bluetooth is in one of the following situations:
- * 1. Bluetooth A2DP is connected.
- * 2. Bluetooth Hearing Aid profile is connected.
- * 3. Bluetooth LE Audio is connected
+ *
+ * <ul>
+ * <li>Bluetooth A2DP is connected.
+ * <li>Bluetooth Hearing Aid profile is connected.
+ * <li>Bluetooth LE Audio is connected
+ * </ul>
*/
-public class BluetoothAirplaneModeListener {
+class BluetoothAirplaneModeListener {
private static final String TAG = "BluetoothAirplaneModeListener";
@VisibleForTesting static final String TOAST_COUNT = "bluetooth_airplane_toast_count";
@@ -89,26 +92,32 @@
@VisibleForTesting int mToastCount = 0;
- BluetoothAirplaneModeListener(BluetoothManagerService service, Looper looper, Context context,
+ BluetoothAirplaneModeListener(
+ BluetoothManagerService service,
+ Looper looper,
+ Context context,
BluetoothNotificationManager notificationManager) {
mBluetoothManager = service;
mNotificationManager = notificationManager;
mContext = context;
mHandler = new BluetoothAirplaneModeHandler(looper);
- context.getContentResolver().registerContentObserver(
- Settings.Global.getUriFor(Settings.Global.AIRPLANE_MODE_ON), true,
- mAirplaneModeObserver);
+ context.getContentResolver()
+ .registerContentObserver(
+ Settings.Global.getUriFor(Settings.Global.AIRPLANE_MODE_ON),
+ true,
+ mAirplaneModeObserver);
}
- private final ContentObserver mAirplaneModeObserver = new ContentObserver(null) {
- @Override
- public void onChange(boolean unused) {
- // Post from system main thread to android_io thread.
- Message msg = mHandler.obtainMessage(MSG_AIRPLANE_MODE_CHANGED);
- mHandler.sendMessage(msg);
- }
- };
+ private final ContentObserver mAirplaneModeObserver =
+ new ContentObserver(null) {
+ @Override
+ public void onChange(boolean selfChange) {
+ // Post from system main thread to android_io thread.
+ Message msg = mHandler.obtainMessage(MSG_AIRPLANE_MODE_CHANGED);
+ mHandler.sendMessage(msg);
+ }
+ };
private class BluetoothAirplaneModeHandler extends Handler {
BluetoothAirplaneModeHandler(Looper looper) {
@@ -128,9 +137,7 @@
}
}
- /**
- * Call after boot complete
- */
+ /** Call after boot complete */
@VisibleForTesting
void start(BluetoothModeChangeHelper helper) {
Log.i(TAG, "start");
@@ -164,7 +171,8 @@
// Airplane mode enabled when Bluetooth is being used for audio/headering aid.
// Bluetooth is not disabled in such case, only state is changed to
// BLUETOOTH_ON_AIRPLANE mode.
- mAirplaneHelper.setSettingsInt(Settings.Global.BLUETOOTH_ON,
+ mAirplaneHelper.setSettingsInt(
+ Settings.Global.BLUETOOTH_ON,
BluetoothManagerService.BLUETOOTH_ON_AIRPLANE);
if (!isApmEnhancementEnabled() || !isBluetoothToggledOnApm()) {
if (shouldPopToast()) {
@@ -173,17 +181,20 @@
} else {
if (isWifiEnabledOnApm() && isFirstTimeNotification(APM_WIFI_BT_NOTIFICATION)) {
try {
- sendApmNotification("bluetooth_and_wifi_stays_on_title",
+ sendApmNotification(
+ "bluetooth_and_wifi_stays_on_title",
"bluetooth_and_wifi_stays_on_message",
APM_WIFI_BT_NOTIFICATION);
} catch (Exception e) {
- Log.e(TAG,
+ Log.e(
+ TAG,
"APM enhancement BT and Wi-Fi stays on notification not shown");
}
- } else if (!isWifiEnabledOnApm() && isFirstTimeNotification(
- APM_BT_NOTIFICATION)) {
+ } else if (!isWifiEnabledOnApm()
+ && isFirstTimeNotification(APM_BT_NOTIFICATION)) {
try {
- sendApmNotification("bluetooth_stays_on_title",
+ sendApmNotification(
+ "bluetooth_stays_on_title",
"bluetooth_stays_on_message",
APM_BT_NOTIFICATION);
} catch (Exception e) {
@@ -194,7 +205,8 @@
return;
}
} else {
- BluetoothStatsLog.write(BluetoothStatsLog.AIRPLANE_MODE_SESSION_REPORTED,
+ BluetoothStatsLog.write(
+ BluetoothStatsLog.AIRPLANE_MODE_SESSION_REPORTED,
BluetoothStatsLog.AIRPLANE_MODE_SESSION_REPORTED__PACKAGE_NAME__BLUETOOTH,
mIsBluetoothOnBeforeApmToggle,
mIsBluetoothOnAfterApmToggle,
@@ -215,19 +227,22 @@
// APM feature disabled or user has not used the feature yet by changing BT state in APM
// BT will only remain on in APM when media profile is connected
- if (!apmEnhancementUsed && mAirplaneHelper.isBluetoothOn()
+ if (!apmEnhancementUsed
+ && mAirplaneHelper.isBluetoothOn()
&& mAirplaneHelper.isMediaProfileConnected()) {
return true;
}
// APM feature enabled and user has used the feature by changing BT state in APM
// BT will only remain on in APM based on user's last action in APM
- if (apmEnhancementUsed && mAirplaneHelper.isBluetoothOn()
+ if (apmEnhancementUsed
+ && mAirplaneHelper.isBluetoothOn()
&& mAirplaneHelper.isBluetoothOnAPM()) {
return true;
}
// APM feature enabled and user has not used the feature yet by changing BT state in APM
// BT will only remain on in APM if the default value is set to on
- if (isApmEnhancementEnabled() && !isBluetoothToggledOnApm()
+ if (isApmEnhancementEnabled()
+ && !isBluetoothToggledOnApm()
&& mAirplaneHelper.isBluetoothOn()
&& mAirplaneHelper.isBluetoothOnAPM()) {
return true;
@@ -249,34 +264,30 @@
}
private boolean isFirstTimeNotification(String name) {
- return mAirplaneHelper.getSettingsSecureInt(
- name, NOTIFICATION_NOT_SHOWN) == NOTIFICATION_NOT_SHOWN;
+ return mAirplaneHelper.getSettingsSecureInt(name, NOTIFICATION_NOT_SHOWN)
+ == NOTIFICATION_NOT_SHOWN;
}
- /**
- * Helper method to send APM notification
- */
+ /** Helper method to send APM notification */
public void sendApmNotification(String titleId, String messageId, String notificationState)
throws PackageManager.NameNotFoundException {
String btPackageName = mAirplaneHelper.getBluetoothPackageName();
if (btPackageName == null) {
- Log.e(TAG, "Unable to find Bluetooth package name with "
- + "APM notification resources");
+ Log.e(
+ TAG,
+ "Unable to find Bluetooth package name with " + "APM notification resources");
return;
}
- Resources resources = mContext.getPackageManager()
- .getResourcesForApplication(btPackageName);
+ Resources resources =
+ mContext.getPackageManager().getResourcesForApplication(btPackageName);
int title = resources.getIdentifier(titleId, "string", btPackageName);
int message = resources.getIdentifier(messageId, "string", btPackageName);
mNotificationManager.sendApmNotification(
resources.getString(title), resources.getString(message));
- mAirplaneHelper.setSettingsSecureInt(notificationState,
- NOTIFICATION_SHOWN);
+ mAirplaneHelper.setSettingsSecureInt(notificationState, NOTIFICATION_SHOWN);
}
- /**
- * Helper method to update whether user toggled Bluetooth in airplane mode
- */
+ /** Helper method to update whether user toggled Bluetooth in airplane mode */
public void updateBluetoothToggledTime() {
if (!mUserToggledBluetoothDuringApm) {
mUserToggledBluetoothDuringApmWithinMinute =