davinci: parts: Try to take the motor back on boot when opened

Co-authored-by: Arian <arian.kulmer@web.de>
Change-Id: I36ff53e23221b6704f0fa5e108329722cf71f504
This commit is contained in:
jhenrique09 2020-04-05 15:47:01 -03:00 committed by Arian
parent 619c58031f
commit b4dca743ea
No known key found for this signature in database
GPG Key ID: 48029380598CE3B9

View File

@ -134,9 +134,23 @@ public class PopupCameraService extends Service implements Handler.Callback {
} }
} }
private void onBootCompleted(){
try {
int status = mMotor.getMotorStatus();
if (status == Constants.MOTOR_STATUS_POPUP ||
status == Constants.MOTOR_STATUS_TAKEBACK_JAM) {
if (DEBUG) Log.d(TAG, "Opened front camera detected, taking back");
mMotor.takebackMotor(1);
}
} catch (RemoteException e) {
// Do nothing
}
}
@Override @Override
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
if (DEBUG) Log.d(TAG, "Starting service"); if (DEBUG) Log.d(TAG, "Starting service");
onBootCompleted();
return START_STICKY; return START_STICKY;
} }