Loading res/layout/permissions_list.xml +1 −24 Original line number Diff line number Diff line Loading @@ -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> src/com/android/packageinstaller/PackageInstallerActivity.java +47 −46 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 Loading @@ -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); Loading @@ -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); } Loading Loading @@ -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. Loading Loading @@ -665,7 +661,26 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen // story ends; assume success. mInstallFlowAnalytics.setFlowFinishedWithPackageManagerResult( PackageManager.INSTALL_SUCCEEDED); finish(); } else { startInstall(); } } else { mScrollView.pageScroll(View.FOCUS_DOWN); } } else if(v == mCancel) { // Cancel and finish setResult(RESULT_CANCELED); if (mSessionId != -1) { mInstaller.setPermissionsResult(mSessionId, false); } mInstallFlowAnalytics.setFlowFinished( InstallFlowAnalytics.RESULT_CANCELLED_BY_USER); finish(); } } private void startInstall() { // Start subactivity to actually install the application Intent newIntent = new Intent(); newIntent.putExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO, Loading Loading @@ -696,20 +711,6 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen } if(localLOGV) Log.i(TAG, "downloaded app uri="+mPackageURI); startActivity(newIntent); } finish(); } else { mScrollView.pageScroll(View.FOCUS_DOWN); } } else if(v == mCancel) { // Cancel and finish setResult(RESULT_CANCELED); if (mSessionId != -1) { mInstaller.setPermissionsResult(mSessionId, false); } mInstallFlowAnalytics.setFlowFinished( InstallFlowAnalytics.RESULT_CANCELLED_BY_USER); finish(); } } } Loading
res/layout/permissions_list.xml +1 −24 Original line number Diff line number Diff line Loading @@ -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>
src/com/android/packageinstaller/PackageInstallerActivity.java +47 −46 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 Loading @@ -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); Loading @@ -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); } Loading Loading @@ -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. Loading Loading @@ -665,7 +661,26 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen // story ends; assume success. mInstallFlowAnalytics.setFlowFinishedWithPackageManagerResult( PackageManager.INSTALL_SUCCEEDED); finish(); } else { startInstall(); } } else { mScrollView.pageScroll(View.FOCUS_DOWN); } } else if(v == mCancel) { // Cancel and finish setResult(RESULT_CANCELED); if (mSessionId != -1) { mInstaller.setPermissionsResult(mSessionId, false); } mInstallFlowAnalytics.setFlowFinished( InstallFlowAnalytics.RESULT_CANCELLED_BY_USER); finish(); } } private void startInstall() { // Start subactivity to actually install the application Intent newIntent = new Intent(); newIntent.putExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO, Loading Loading @@ -696,20 +711,6 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen } if(localLOGV) Log.i(TAG, "downloaded app uri="+mPackageURI); startActivity(newIntent); } finish(); } else { mScrollView.pageScroll(View.FOCUS_DOWN); } } else if(v == mCancel) { // Cancel and finish setResult(RESULT_CANCELED); if (mSessionId != -1) { mInstaller.setPermissionsResult(mSessionId, false); } mInstallFlowAnalytics.setFlowFinished( InstallFlowAnalytics.RESULT_CANCELLED_BY_USER); finish(); } } }