summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xAndroidManifest.xml34
-rw-r--r--src/com/android/camera/CameraActivity.java3
-rw-r--r--src/com/android/camera/PermissionsActivity.java26
3 files changed, 44 insertions, 19 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index fe8ced2..23b517a 100755
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -52,18 +52,6 @@
android:taskAffinity="com.android.camera.CameraActivity"
android:theme="@style/Theme.Camera"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" >
- <intent-filter>
- <action android:name="android.media.action.IMAGE_CAPTURE" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- <intent-filter>
- <action android:name="android.media.action.STILL_IMAGE_CAMERA" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
</activity>
<activity
@@ -88,12 +76,32 @@
</intent-filter>
</activity-alias>
+ <activity-alias
+ android:name="com.android.camera.PhotoCamera"
+ android:icon="@mipmap/ic_launcher_camera"
+ android:label="@string/app_name"
+ android:launchMode="singleTop"
+ android:targetActivity="com.android.camera.PermissionsActivity">
+ <intent-filter>
+ <action android:name="android.media.action.IMAGE_CAPTURE" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.media.action.STILL_IMAGE_CAMERA" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity-alias>
+
<!-- Video camera and capture use the Camcorder label and icon. -->
<activity-alias
android:name="com.android.camera.VideoCamera"
android:label="@string/video_camera_label"
android:launchMode="singleTop"
- android:targetActivity="com.android.camera.CameraActivity">
+ android:targetActivity="com.android.camera.PermissionsActivity">
<intent-filter>
<action android:name="android.media.action.VIDEO_CAMERA" />
<category android:name="android.intent.category.DEFAULT" />
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index c4cd401..3458e8c 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -1739,8 +1739,7 @@ public class CameraActivity extends Activity
mHasCriticalPermissions = false;
}
- if ((checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) !=
- PackageManager.PERMISSION_GRANTED) || !mHasCriticalPermissions) {
+ if (!mHasCriticalPermissions) {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean isRequestShown = prefs.getBoolean(CameraSettings.KEY_REQUEST_PERMISSION, false);
if(!isRequestShown || !mHasCriticalPermissions) {
diff --git a/src/com/android/camera/PermissionsActivity.java b/src/com/android/camera/PermissionsActivity.java
index c720d21..e623be2 100644
--- a/src/com/android/camera/PermissionsActivity.java
+++ b/src/com/android/camera/PermissionsActivity.java
@@ -33,16 +33,20 @@ public class PermissionsActivity extends Activity {
private boolean mFlagHasMicrophonePermission;
private boolean mFlagHasStoragePermission;
private boolean mCriticalPermissionDenied;
+ private Intent mIntent;
+ private boolean mIsReturnResult;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ mIntent = getIntent();
+ mIsReturnResult = false;
}
@Override
protected void onResume() {
super.onResume();
- if (!mCriticalPermissionDenied) {
+ if (!mCriticalPermissionDenied && !mIsReturnResult) {
mNumPermissionsToRequest = 0;
checkPermissions();
} else {
@@ -164,9 +168,16 @@ public class PermissionsActivity extends Activity {
}
private void handlePermissionsSuccess() {
- Intent intent = new Intent(this, CameraActivity.class);
- startActivity(intent);
- finish();
+ if (mIntent != null) {
+ mIsReturnResult = true;
+ mIntent.setClass(this, CameraActivity.class);
+ startActivityForResult(mIntent, 1);
+ } else {
+ mIsReturnResult = false;
+ Intent intent = new Intent(this, CameraActivity.class);
+ startActivity(intent);
+ finish();
+ }
}
private void handlePermissionsFailure() {
@@ -192,4 +203,11 @@ public class PermissionsActivity extends Activity {
})
.show();
}
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ setResult(resultCode, data);
+ finish();
+ }
}