diff options
author | Julia Reynolds <juliacr@google.com> | 2015-07-13 17:15:04 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-13 17:15:05 +0000 |
commit | d138f2c8ab877a8dd4b00d02358c2e9c528a174f (patch) | |
tree | 9f29a9ec1f7588ab28085c3a90e8438b50c173c7 | |
parent | de11bbe506dfac39271fe21b7aa044d946cd3a61 (diff) | |
parent | 2b5cc1da682ffe011f71b26f27eacdba68e1f8bb (diff) | |
download | android_packages_apps_PackageInstaller-d138f2c8ab877a8dd4b00d02358c2e9c528a174f.tar.gz android_packages_apps_PackageInstaller-d138f2c8ab877a8dd4b00d02358c2e9c528a174f.tar.bz2 android_packages_apps_PackageInstaller-d138f2c8ab877a8dd4b00d02358c2e9c528a174f.zip |
Merge "Remove personal/device group & skip perm screen for M+ apps." into mnc-dev
-rw-r--r-- | res/layout/permissions_list.xml | 25 | ||||
-rw-r--r-- | src/com/android/packageinstaller/PackageInstallerActivity.java | 93 |
2 files changed, 48 insertions, 70 deletions
diff --git a/res/layout/permissions_list.xml b/res/layout/permissions_list.xml index c2b2b2a0..5e3ae0f5 100644 --- a/res/layout/permissions_list.xml +++ b/res/layout/permissions_list.xml @@ -22,33 +22,10 @@ This is the structure for the list of all permissions. android:id="@+id/scrollview" android:fillViewport="true"> <LinearLayout + android:id="@+id/permission_list" android:orientation="vertical" android:layout_width="match_parent" android:paddingEnd="4dp" android:layout_height="wrap_content"> - <LinearLayout android:id="@+id/privacylist" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="4dp" - android:layout_marginBottom="4dp"> - <TextView - style="?android:attr/listSeparatorTextViewStyle" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - android:text="@string/privacyPerms" /> - </LinearLayout> - <LinearLayout android:id="@+id/devicelist" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="4dp" - android:layout_marginBottom="4dp"> - <TextView - style="?android:attr/listSeparatorTextViewStyle" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - android:text="@string/devicePerms" /> - </LinearLayout> </LinearLayout> </com.android.packageinstaller.CaffeinatedScrollView> diff --git a/src/com/android/packageinstaller/PackageInstallerActivity.java b/src/com/android/packageinstaller/PackageInstallerActivity.java index 9153d71a..e9b50315 100644 --- a/src/com/android/packageinstaller/PackageInstallerActivity.java +++ b/src/com/android/packageinstaller/PackageInstallerActivity.java @@ -36,6 +36,7 @@ import android.content.pm.PackageUserState; import android.content.pm.ResolveInfo; import android.content.pm.VerificationParams; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.SystemClock; import android.os.UserManager; @@ -132,8 +133,7 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen int msg = 0; if (mPkgInfo != null) { AppSecurityPermissions perms = new AppSecurityPermissions(this, mPkgInfo); - final int NP = perms.getPermissionCount(AppSecurityPermissions.WHICH_PERSONAL); - final int ND = perms.getPermissionCount(AppSecurityPermissions.WHICH_DEVICE); + final int N = perms.getPermissionCount(AppSecurityPermissions.WHICH_ALL); if (mAppInfo != null) { msg = (mAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0 ? R.string.install_confirm_question_update_system @@ -160,7 +160,7 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen findViewById(R.id.tabscontainer).setVisibility(View.GONE); findViewById(R.id.divider).setVisibility(View.VISIBLE); } - if (NP > 0 || ND > 0) { + if (N > 0) { permVisible = true; LayoutInflater inflater = (LayoutInflater)getSystemService( Context.LAYOUT_INFLATER_SERVICE); @@ -168,18 +168,8 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen if (mScrollView == null) { mScrollView = (CaffeinatedScrollView)root.findViewById(R.id.scrollview); } - if (NP > 0) { - ((ViewGroup)root.findViewById(R.id.privacylist)).addView( - perms.getPermissionsView(AppSecurityPermissions.WHICH_PERSONAL)); - } else { - root.findViewById(R.id.privacylist).setVisibility(View.GONE); - } - if (ND > 0) { - ((ViewGroup)root.findViewById(R.id.devicelist)).addView( - perms.getPermissionsView(AppSecurityPermissions.WHICH_DEVICE)); - } else { - root.findViewById(R.id.devicelist).setVisibility(View.GONE); - } + ((ViewGroup)root.findViewById(R.id.permission_list)).addView( + perms.getPermissionsView(AppSecurityPermissions.WHICH_ALL)); adapter.addTab(tabHost.newTabSpec(TAB_ID_ALL).setIndicator( getText(R.string.allPerms)), root); } @@ -402,6 +392,12 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen } private void initiateInstall() { + if (mPkgInfo.applicationInfo + .targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1) { + startInstall(); + return; + } + String pkgName = mPkgInfo.packageName; // Check if there is already a package on the device with this name // but it has been renamed to something else. @@ -665,39 +661,10 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen // story ends; assume success. mInstallFlowAnalytics.setFlowFinishedWithPackageManagerResult( PackageManager.INSTALL_SUCCEEDED); + finish(); } else { - // Start subactivity to actually install the application - Intent newIntent = new Intent(); - newIntent.putExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO, - mPkgInfo.applicationInfo); - newIntent.setData(mPackageURI); - newIntent.setClass(this, InstallAppProgress.class); - newIntent.putExtra(InstallAppProgress.EXTRA_MANIFEST_DIGEST, mPkgDigest); - newIntent.putExtra( - InstallAppProgress.EXTRA_INSTALL_FLOW_ANALYTICS, mInstallFlowAnalytics); - String installerPackageName = getIntent().getStringExtra( - Intent.EXTRA_INSTALLER_PACKAGE_NAME); - if (mOriginatingURI != null) { - newIntent.putExtra(Intent.EXTRA_ORIGINATING_URI, mOriginatingURI); - } - if (mReferrerURI != null) { - newIntent.putExtra(Intent.EXTRA_REFERRER, mReferrerURI); - } - if (mOriginatingUid != VerificationParams.NO_UID) { - newIntent.putExtra(Intent.EXTRA_ORIGINATING_UID, mOriginatingUid); - } - if (installerPackageName != null) { - newIntent.putExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME, - installerPackageName); - } - if (getIntent().getBooleanExtra(Intent.EXTRA_RETURN_RESULT, false)) { - newIntent.putExtra(Intent.EXTRA_RETURN_RESULT, true); - newIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); - } - if(localLOGV) Log.i(TAG, "downloaded app uri="+mPackageURI); - startActivity(newIntent); + startInstall(); } - finish(); } else { mScrollView.pageScroll(View.FOCUS_DOWN); } @@ -712,4 +679,38 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen finish(); } } + + private void startInstall() { + // Start subactivity to actually install the application + Intent newIntent = new Intent(); + newIntent.putExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO, + mPkgInfo.applicationInfo); + newIntent.setData(mPackageURI); + newIntent.setClass(this, InstallAppProgress.class); + newIntent.putExtra(InstallAppProgress.EXTRA_MANIFEST_DIGEST, mPkgDigest); + newIntent.putExtra( + InstallAppProgress.EXTRA_INSTALL_FLOW_ANALYTICS, mInstallFlowAnalytics); + String installerPackageName = getIntent().getStringExtra( + Intent.EXTRA_INSTALLER_PACKAGE_NAME); + if (mOriginatingURI != null) { + newIntent.putExtra(Intent.EXTRA_ORIGINATING_URI, mOriginatingURI); + } + if (mReferrerURI != null) { + newIntent.putExtra(Intent.EXTRA_REFERRER, mReferrerURI); + } + if (mOriginatingUid != VerificationParams.NO_UID) { + newIntent.putExtra(Intent.EXTRA_ORIGINATING_UID, mOriginatingUid); + } + if (installerPackageName != null) { + newIntent.putExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME, + installerPackageName); + } + if (getIntent().getBooleanExtra(Intent.EXTRA_RETURN_RESULT, false)) { + newIntent.putExtra(Intent.EXTRA_RETURN_RESULT, true); + newIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); + } + if(localLOGV) Log.i(TAG, "downloaded app uri="+mPackageURI); + startActivity(newIntent); + finish(); + } } |