Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed permission related issues for the SDK #183

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/code-samples/ARBlackPanther/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
api project(':code-samples:gvr_common')
api project(':code-samples:arcore_client')
aarImplementation('com.github.ViroCommunity.virocore:virocore:rc-1.20.2') {
aarImplementation(project(path: ':virocore')) {
transitive = false
}
codeImplementation (project(path: ':virocore')) {
Expand Down
2 changes: 1 addition & 1 deletion android/code-samples/ARHelloWorldAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
api project(':code-samples:gvr_common')
api project(':code-samples:arcore_client')
aarImplementation('com.github.ViroCommunity.virocore:virocore:rc-1.20.2') {
aarImplementation(project(path: ':virocore')) {
transitive = false
}
codeImplementation (project(path: ':virocore')) {
Expand Down
6 changes: 3 additions & 3 deletions android/code-samples/ARPlacingObjects/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
api project(':code-samples:gvr_common')
api project(':code-samples:arcore_client')
aarImplementation('com.github.ViroCommunity.virocore:virocore:rc-1.20.2') {
aarImplementation(project(path: ':virocore')) {
transitive = false
}
codeImplementation (project(path: ':virocore')) {
transitive = false
}
implementation 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7'
implementation "androidx.core:core-ktx:1.8.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.21"
implementation "androidx.core:core-ktx:1.10.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.0"
}
4 changes: 2 additions & 2 deletions android/code-samples/ARRetail/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
api project(':code-samples:gvr_common')
api project(':code-samples:arcore_client')
aarImplementation('com.github.ViroCommunity.virocore:virocore:rc-1.20.2') {
aarImplementation(project(path: ':virocore')) {
transitive = false
}
codeImplementation (project(path: ':virocore')) {
codeImplementation(project(path: ':virocore')) {
transitive = false
}
implementation 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7'
Expand Down
2 changes: 1 addition & 1 deletion android/code-samples/ARTesla/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
api project(':code-samples:gvr_common')
api project(':code-samples:arcore_client')
aarImplementation('com.github.ViroCommunity.virocore:virocore:rc-1.20.2') {
aarImplementation(project(path: ':virocore')) {
transitive = false
}
// api to be able to use BuildConfig in SystemInfoFragment
Expand Down
5 changes: 3 additions & 2 deletions android/sharedCode/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE"/>
<!-- Required to read the paired viewer's distortion parameters. -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<!-- Required for Recording -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />

Expand All @@ -26,4 +27,4 @@
<!-- Indicates use of VR features that are available only on Daydream-ready devices. -->
<uses-feature android:name="android.hardware.vr.high_performance" android:required="false"/>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@
import android.net.Uri;
import android.opengl.GLES20;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import androidx.core.content.ContextCompat;

import android.system.Os;
import android.util.Log;

import com.viro.core.internal.MediaRecorderSurface;
Expand Down Expand Up @@ -292,14 +295,21 @@ private void deleteNativeRecorder(){
private static boolean hasAudioAndRecordingPermissions(Context context) {
boolean hasRecordPermissions = ContextCompat.checkSelfPermission(context,
Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED;
boolean hasExternalStoragePerm = ContextCompat.checkSelfPermission(context,
Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
boolean hasExternalStoragePerm = true;
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) {
hasExternalStoragePerm = ContextCompat.checkSelfPermission(context,
Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
}
return hasRecordPermissions && hasExternalStoragePerm;
}

private static boolean hasRecordingPermissions(Context context) {
return ContextCompat.checkSelfPermission(context,
Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
boolean hasExternalStoragePerm = true;
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) {
hasExternalStoragePerm = ContextCompat.checkSelfPermission(context,
Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
}
return hasExternalStoragePerm;
}

/**
Expand Down Expand Up @@ -876,4 +886,3 @@ public void onNativeTakeScreenshot() {
private native void nativeEnableFrameRecording(long nativeRecorderRef, boolean enabled);
private native void nativeScheduleScreenCapture(long nativeRecorderRef);
}