Permalink
Browse files

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

  • Loading branch information...
hrydgard committed Oct 24, 2017
1 parent f53b455 commit 2c8fb0fbd18ebaade6c4892f73e6baa1fc28f626
Showing with 9 additions and 6 deletions.
  1. +2 −2 GPU/GPUCommon.h
  2. +7 −4 android/src/org/ppsspp/ppsspp/NativeActivity.java
View
@@ -183,7 +183,7 @@ class GPUCommon : public GPUThreadEventQueue, public GPUDebugInterface {
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 @@ class GPUCommon : public GPUThreadEventQueue, public GPUDebugInterface {
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 {}
@@ -226,7 +226,7 @@ public void onRequestPermissionsResult(int requestCode,
}
break;
case REQUEST_CODE_CAMERA_PERMISSION:
if (permissionsGranted(permissions, grantResults)) {
if (mCameraHelper != null && permissionsGranted(permissions, grantResults)) {
mCameraHelper.startCamera();
}
break;
@@ -332,7 +332,10 @@ public void Initialize() {
}
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 boolean processCommand(String command, String params) {
}
} 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();
}
}

0 comments on commit 2c8fb0f

Please sign in to comment.