Can't use the camera stuff on Android versions before 11. Fixes #10029.

This commit is contained in:
Henrik Rydgård 2017-10-24 15:38:16 +02:00
parent f53b455dce
commit 2c8fb0fbd1
2 changed files with 9 additions and 6 deletions

View File

@ -183,7 +183,7 @@ public:
std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override {
return "N/A";
}
bool DescribeCodePtr(const u8 *ptr, std::string &name);
bool DescribeCodePtr(const u8 *ptr, std::string &name) override;
std::vector<DisplayList> ActiveDisplayLists() override;
void ResetListPC(int listID, u32 pc) override;
@ -227,7 +227,7 @@ public:
bool DecodeTexture(u8* dest, const GPUgstate &state) override {
return false;
}
std::vector<FramebufferInfo> GetFramebufferList();
std::vector<FramebufferInfo> GetFramebufferList() override;
void ClearShaderCache() override {}
void CleanupBeforeUI() override {}

View File

@ -226,7 +226,7 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
}
break;
case REQUEST_CODE_CAMERA_PERMISSION:
if (permissionsGranted(permissions, grantResults)) {
if (mCameraHelper != null && permissionsGranted(permissions, grantResults)) {
mCameraHelper.startCamera();
}
break;
@ -332,7 +332,10 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
}
mLocationHelper = new LocationHelper(this);
mCameraHelper = new CameraHelper(this);
if (Build.VERSION.SDK_INT >= 11) {
// android.graphics.SurfaceTexture is not available before version 11.
mCameraHelper = new CameraHelper(this);
}
}
@TargetApi(24)
@ -1209,10 +1212,10 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
}
} else if (command.equals("camera_command")) {
if (params.equals("startVideo")) {
if (!askForPermissions(permissionsForCamera, REQUEST_CODE_CAMERA_PERMISSION)) {
if (mCameraHelper != null && !askForPermissions(permissionsForCamera, REQUEST_CODE_CAMERA_PERMISSION)) {
mCameraHelper.startCamera();
}
} else if (params.equals("stopVideo")) {
} else if (mCameraHelper != null && params.equals("stopVideo")) {
mCameraHelper.stopCamera();
}
}