Permalink
Browse files

Android: Consistently use version constants.

  • Loading branch information...
unknownbrackets committed Oct 7, 2018
1 parent 486707b commit d5d572d38e7df89e0615cc1594b5ef1385990a53
Showing with 25 additions and 25 deletions.
  1. +25 −25 android/src/org/ppsspp/ppsspp/NativeActivity.java
@@ -142,7 +142,7 @@ NativeRenderer getRenderer() {
return nativeRenderer;
}
@TargetApi(17)
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void detectOptimalAudioSettings() {
try {
optimalFramesPerBuffer = Integer.parseInt(this.audioManager.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER));
@@ -174,7 +174,7 @@ String getApplicationLibraryDir(ApplicationInfo application) {
return libdir;
}
@TargetApi(23)
@TargetApi(Build.VERSION_CODES.M)
boolean askForPermissions(String[] permissions, int requestCode) {
boolean shouldAsk = false;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
@@ -190,7 +190,7 @@ boolean askForPermissions(String[] permissions, int requestCode) {
return shouldAsk;
}
@TargetApi(23)
@TargetApi(Build.VERSION_CODES.M)
public void sendInitialGrants() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// Let's start out granted if it was granted already.
@@ -244,12 +244,12 @@ public void Initialize() {
this.audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
this.audioFocusChangeListener = new AudioFocusChangeListener();
if (Build.VERSION.SDK_INT >= 17) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
// Get the optimal buffer sz
detectOptimalAudioSettings();
}
powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
if (Build.VERSION.SDK_INT >= 24) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
if (powerManager.isSustainedPerformanceModeSupported()) {
sustainedPerfSupported = true;
NativeApp.sendMessage("sustained_perf_supported", "1");
@@ -314,7 +314,7 @@ public void Initialize() {
PowerSaveModeReceiver.initAndSend(this);
// OK, config should be initialized, we can query for screen rotation.
if (Build.VERSION.SDK_INT >= 9) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
updateScreenRotation("Initialize");
}
@@ -331,18 +331,18 @@ public void Initialize() {
}
vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
if (Build.VERSION.SDK_INT >= 11) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
checkForVibrator();
}
mLocationHelper = new LocationHelper(this);
if (Build.VERSION.SDK_INT >= 11) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// android.graphics.SurfaceTexture is not available before version 11.
mCameraHelper = new CameraHelper(this);
}
}
@TargetApi(24)
@TargetApi(Build.VERSION_CODES.N)
private void updateSustainedPerformanceMode() {
if (sustainedPerfSupported) {
// Query the native application on the desired rotation.
@@ -358,7 +358,7 @@ private void updateSustainedPerformanceMode() {
}
}
@TargetApi(9)
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
private void updateScreenRotation(String cause) {
// Query the native application on the desired rotation.
int rot = 0;
@@ -401,7 +401,7 @@ private boolean useImmersive() {
}
@SuppressLint("InlinedApi")
@TargetApi(14)
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void updateSystemUiVisibility() {
int flags = 0;
if (useLowProfileButtons()) {
@@ -419,9 +419,9 @@ private void updateSystemUiVisibility() {
}
// Need API 11 to check for existence of a vibrator? Zany.
@TargetApi(11)
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void checkForVibrator() {
if (Build.VERSION.SDK_INT >= 11) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
if (!vibrator.hasVibrator()) {
vibrator = null;
}
@@ -451,12 +451,12 @@ public void getDesiredBackbufferSize(Point sz) {
sz.y = NativeApp.getDesiredBackbufferHeight();
}
@TargetApi(17)
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public void updateDisplayMeasurements() {
Display display = getWindowManager().getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
if (useImmersive() && Build.VERSION.SDK_INT >= 17) {
if (useImmersive() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
display.getRealMetrics(metrics);
} else {
display.getMetrics(metrics);
@@ -651,7 +651,7 @@ private synchronized void joinRenderLoopThread() {
}
}
@TargetApi(19)
@TargetApi(Build.VERSION_CODES.KITKAT)
void setupSystemUiCallback() {
getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(new OnSystemUiVisibilityChangeListener() {
@Override
@@ -745,7 +745,7 @@ protected void onResume() {
updateSystemUiVisibility();
}
// OK, config should be initialized, we can query for screen rotation.
if (javaGL || Build.VERSION.SDK_INT >= 9) {
if (javaGL || Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
updateScreenRotation("onResume");
}
@@ -892,7 +892,7 @@ public boolean dispatchKeyEvent(KeyEvent event) {
return super.dispatchKeyEvent(event);
}
@TargetApi(16)
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static String getInputDesc(InputDevice input) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
return input.getDescriptor();
@@ -906,11 +906,11 @@ public static String getInputDesc(InputDevice input) {
}
@Override
@TargetApi(12)
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
public boolean onGenericMotionEvent(MotionEvent event) {
// Log.d(TAG, "onGenericMotionEvent: " + event);
if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) != 0) {
if (Build.VERSION.SDK_INT >= 12) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
InputDeviceState state = getInputDeviceState(event);
if (state == null) {
Log.w(TAG, "Joystick event but failed to get input device state.");
@@ -1025,19 +1025,19 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}
}
@TargetApi(11)
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@SuppressWarnings("deprecation")
private AlertDialog.Builder createDialogBuilderWithTheme() {
return new AlertDialog.Builder(this, AlertDialog.THEME_HOLO_DARK);
}
@TargetApi(14)
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@SuppressWarnings("deprecation")
private AlertDialog.Builder createDialogBuilderWithDeviceTheme() {
return new AlertDialog.Builder(this, AlertDialog.THEME_DEVICE_DEFAULT_DARK);
}
@TargetApi(17)
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@SuppressWarnings("deprecation")
private AlertDialog.Builder createDialogBuilderWithDeviceThemeAndUiVisibility() {
AlertDialog.Builder bld = new AlertDialog.Builder(this, AlertDialog.THEME_DEVICE_DEFAULT_DARK);
@@ -1050,7 +1050,7 @@ public void onDismiss(DialogInterface dialog) {
return bld;
}
@TargetApi(23)
@TargetApi(Build.VERSION_CODES.M)
private AlertDialog.Builder createDialogBuilderNew() {
AlertDialog.Builder bld = new AlertDialog.Builder(this, android.R.style.Theme_DeviceDefault_Dialog_Alert);
bld.setOnDismissListener(new DialogInterface.OnDismissListener() {
@@ -1260,7 +1260,7 @@ public boolean processCommand(String command, String params) {
Log.i(TAG, "Must recreate activity on rotation");
}
} else {
if (Build.VERSION.SDK_INT >= 9) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
updateScreenRotation("rotate");
}
}

0 comments on commit d5d572d

Please sign in to comment.