Replaced exception with more elegant option in Time Settings
Currently, some controllers in the Date and Time settings page throw exceptions if a capability is not known. This would cause the Settings app to crash, so we are moving away from exception and replacing it with the deactivation of the controller. Test: manual Flag: EXEMPT refactor Bug: 296835792 Change-Id: I56b01ec6d9eebf721deeb4f67aa177742482dd53
This commit is contained in:
@@ -25,6 +25,7 @@ import android.app.time.TimeZoneCapabilities;
|
||||
import android.app.time.TimeZoneCapabilitiesAndConfig;
|
||||
import android.app.time.TimeZoneConfiguration;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
@@ -138,7 +139,8 @@ public class LocationTimeZoneDetectionPreferenceController
|
||||
} else if (capability == CAPABILITY_NOT_APPLICABLE || capability == CAPABILITY_POSSESSED) {
|
||||
return isAutoTimeZoneEnabled() ? AVAILABLE : DISABLED_DEPENDENT_SETTING;
|
||||
} else {
|
||||
throw new IllegalStateException("Unknown capability=" + capability);
|
||||
Log.e(TAG, "Unknown capability=" + capability);
|
||||
return UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user