davinci: parts: clang-format

Change-Id: I90c5c1f9529277821cd3a05ba4861588e8a6f323
This commit is contained in:
Arian 2020-10-11 13:09:03 +02:00
parent 358b4e7a2b
commit 4df3381a1d
No known key found for this signature in database
GPG Key ID: 48029380598CE3B9
6 changed files with 56 additions and 57 deletions

View File

@ -19,7 +19,7 @@ package org.lineageos.settings.popupcamera;
public class Constants {
public static final int FREE_FALL_SENSOR_ID = 33171042;
public static final int CAMERA_EVENT_DELAY_TIME = 100; //ms
public static final int CAMERA_EVENT_DELAY_TIME = 100; // ms
public static final int MSG_CAMERA_CLOSED = 1001;
public static final int MSG_CAMERA_OPEN = 1002;

View File

@ -21,7 +21,6 @@ import android.content.SharedPreferences;
import android.preference.PreferenceManager;
public class PopupCameraPreferences {
private static final String TAG = "PopupCameraUtils";
private static final boolean DEBUG = false;
private static final String LED_EFFECT_KEY = "popup_led_effect";

View File

@ -40,7 +40,6 @@ import org.lineageos.settings.utils.FileUtils;
import vendor.xiaomi.hardware.motor.V1_0.IMotor;
public class PopupCameraService extends Service implements Handler.Callback {
private static final String TAG = "PopupCameraService";
private static final boolean DEBUG = false;
@ -64,12 +63,12 @@ public class PopupCameraService extends Service implements Handler.Callback {
if (cameraId.equals(Constants.FRONT_CAMERA_ID)) {
mClosedEvent = SystemClock.elapsedRealtime();
if (SystemClock.elapsedRealtime() - mOpenEvent
< Constants.CAMERA_EVENT_DELAY_TIME && mHandler.hasMessages(
Constants.MSG_CAMERA_OPEN)) {
< Constants.CAMERA_EVENT_DELAY_TIME
&& mHandler.hasMessages(Constants.MSG_CAMERA_OPEN)) {
mHandler.removeMessages(Constants.MSG_CAMERA_OPEN);
}
mHandler.sendEmptyMessageDelayed(Constants.MSG_CAMERA_CLOSED,
Constants.CAMERA_EVENT_DELAY_TIME);
mHandler.sendEmptyMessageDelayed(
Constants.MSG_CAMERA_CLOSED, Constants.CAMERA_EVENT_DELAY_TIME);
}
}
@ -79,12 +78,12 @@ public class PopupCameraService extends Service implements Handler.Callback {
if (cameraId.equals(Constants.FRONT_CAMERA_ID)) {
mOpenEvent = SystemClock.elapsedRealtime();
if (SystemClock.elapsedRealtime() - mClosedEvent
< Constants.CAMERA_EVENT_DELAY_TIME && mHandler.hasMessages(
Constants.MSG_CAMERA_CLOSED)) {
< Constants.CAMERA_EVENT_DELAY_TIME
&& mHandler.hasMessages(Constants.MSG_CAMERA_CLOSED)) {
mHandler.removeMessages(Constants.MSG_CAMERA_CLOSED);
}
mHandler.sendEmptyMessageDelayed(Constants.MSG_CAMERA_OPEN,
Constants.CAMERA_EVENT_DELAY_TIME);
mHandler.sendEmptyMessageDelayed(
Constants.MSG_CAMERA_OPEN, Constants.CAMERA_EVENT_DELAY_TIME);
}
}
};
@ -99,8 +98,7 @@ public class PopupCameraService extends Service implements Handler.Callback {
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
public void onAccuracyChanged(Sensor sensor, int accuracy) {}
};
@Override
@ -110,12 +108,16 @@ public class PopupCameraService extends Service implements Handler.Callback {
mSensorManager = getSystemService(SensorManager.class);
mFreeFallSensor = mSensorManager.getDefaultSensor(Constants.FREE_FALL_SENSOR_ID);
mPopupCameraPreferences = new PopupCameraPreferences(this);
mSoundPool = new SoundPool.Builder().setMaxStreams(1)
.setAudioAttributes(new AudioAttributes.Builder()
mSoundPool =
new SoundPool.Builder()
.setMaxStreams(1)
.setAudioAttributes(
new AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.setFlags(AudioAttributes.FLAG_AUDIBILITY_ENFORCED)
.build()).build();
.build())
.build();
String[] soundNames = getResources().getStringArray(R.array.popupcamera_effects_names);
mSounds = new int[soundNames.length];
for (int i = 0; i < soundNames.length; i++) {
@ -136,13 +138,15 @@ public class PopupCameraService extends Service implements Handler.Callback {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (DEBUG) Log.d(TAG, "Starting service");
if (DEBUG)
Log.d(TAG, "Starting service");
return START_STICKY;
}
@Override
public void onDestroy() {
if (DEBUG) Log.d(TAG, "Destroying service");
if (DEBUG)
Log.d(TAG, "Destroying service");
super.onDestroy();
}
@ -164,8 +168,8 @@ public class PopupCameraService extends Service implements Handler.Callback {
lightUp();
playSoundEffect(Constants.OPEN_CAMERA_STATE);
mMotor.popupMotor(1);
mSensorManager.registerListener(mFreeFallListener, mFreeFallSensor,
SensorManager.SENSOR_DELAY_NORMAL);
mSensorManager.registerListener(
mFreeFallListener, mFreeFallSensor, SensorManager.SENSOR_DELAY_NORMAL);
} else if (cameraState.equals(Constants.CLOSE_CAMERA_STATE)
&& mMotor.getMotorStatus() == Constants.MOTOR_STATUS_POPUP) {
lightUp();
@ -212,8 +216,7 @@ public class PopupCameraService extends Service implements Handler.Callback {
if (state.equals(Constants.CLOSE_CAMERA_STATE)) {
soundEffect++;
}
mSoundPool.play(mSounds[soundEffect], 1.0f, 1.0f, 0,
0, 1.0f);
mSoundPool.play(mSounds[soundEffect], 1.0f, 1.0f, 0, 0, 1.0f);
}
}
@ -229,12 +232,10 @@ public class PopupCameraService extends Service implements Handler.Callback {
switch (msg.what) {
case Constants.MSG_CAMERA_CLOSED: {
updateMotor(Constants.CLOSE_CAMERA_STATE);
}
break;
} break;
case Constants.MSG_CAMERA_OPEN: {
updateMotor(Constants.OPEN_CAMERA_STATE);
}
break;
} break;
}
return true;
}

View File

@ -20,14 +20,15 @@ import android.os.Bundle;
import android.preference.PreferenceActivity;
public class PopupCameraSettingsActivity extends PreferenceActivity {
private static final String TAG_POPUPCAMERA = "popupcamera";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction().replace(android.R.id.content,
new PopupCameraSettingsFragment(), TAG_POPUPCAMERA).commit();
getFragmentManager()
.beginTransaction()
.replace(android.R.id.content, new PopupCameraSettingsFragment(), TAG_POPUPCAMERA)
.commit();
}
}

View File

@ -25,9 +25,8 @@ import androidx.preference.PreferenceFragment;
import org.lineageos.settings.R;
public class PopupCameraSettingsFragment extends PreferenceFragment implements
OnPreferenceChangeListener {
public class PopupCameraSettingsFragment
extends PreferenceFragment implements OnPreferenceChangeListener {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.popup_settings);

View File

@ -21,12 +21,11 @@ import android.content.Intent;
import android.os.UserHandle;
public class PopupCameraUtils {
private static final String TAG = "PopupCameraUtils";
private static final boolean DEBUG = false;
public static void startService(Context context) {
context.startServiceAsUser(new Intent(context, PopupCameraService.class),
UserHandle.CURRENT);
context.startServiceAsUser(
new Intent(context, PopupCameraService.class), UserHandle.CURRENT);
}
}