Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29e21c09 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix UI janky in privacy settings"

parents 2f151c61 327dba24
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -50,6 +50,7 @@
    <Preference
    <Preference
        android:key="privacy_manage_perms"
        android:key="privacy_manage_perms"
        android:title="@string/app_permissions"
        android:title="@string/app_permissions"
        android:summary="@string/summary_placeholder"
        settings:allowDividerAbove="true"
        settings:allowDividerAbove="true"
        settings:keywords="@string/keywords_app_permissions"
        settings:keywords="@string/keywords_app_permissions"
        settings:controller="com.android.settings.applications.AppPermissionsPreferenceController">
        settings:controller="com.android.settings.applications.AppPermissionsPreferenceController">
+1 −1
Original line number Original line Diff line number Diff line
@@ -105,7 +105,7 @@ public class AppPermissionsPreferenceController extends BasePreferenceController
        final CharSequence summary = !permissionsToShow.isEmpty()
        final CharSequence summary = !permissionsToShow.isEmpty()
                ? mContext.getString(R.string.app_permissions_summary,
                ? mContext.getString(R.string.app_permissions_summary,
                ListFormatter.getInstance().format(permissionsToShow).toLowerCase())
                ListFormatter.getInstance().format(permissionsToShow).toLowerCase())
                : null;
                : mContext.getString(R.string.runtime_permissions_summary_no_permissions_granted);
        mPreference.setSummary(summary);
        mPreference.setSummary(summary);
    }
    }
}
}
 No newline at end of file
+5 −2
Original line number Original line Diff line number Diff line
@@ -31,6 +31,8 @@ import android.content.pm.PackageManager.NameNotFoundException;


import androidx.preference.Preference;
import androidx.preference.Preference;


import com.android.settings.R;

import org.junit.Before;
import org.junit.Before;
import org.junit.Test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runner.RunWith;
@@ -70,14 +72,15 @@ public class AppPermissionsPreferenceControllerTest {
    }
    }


    @Test
    @Test
    public void updateSummary_noGrantedPermission_shouldSetNullSummary() {
    public void updateSummary_noGrantedPermission_shouldSetNoPermissionGrantedSummary() {
        doNothing().when(mController).queryPermissionSummary();
        doNothing().when(mController).queryPermissionSummary();
        mController.updateState(mPreference);
        mController.updateState(mPreference);
        mController.mNumPackageChecked = 2;
        mController.mNumPackageChecked = 2;


        mController.updateSummary(new ArrayList<>());
        mController.updateSummary(new ArrayList<>());


        assertThat(mPreference.getSummary()).isNull();
        assertThat(mPreference.getSummary()).isEqualTo(
                mContext.getString(R.string.runtime_permissions_summary_no_permissions_granted));
    }
    }


    @Test
    @Test