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

Commit f7ac4baf authored by Vinod Krishnan's avatar Vinod Krishnan Committed by Android (Google) Code Review
Browse files

Merge changes I285e3269,I0c4c9ceb into nyc-dev

* changes:
  Show No permissions, if there are no permissions
  Wear Cleanup: Removing implicit intent & API change
parents ad6218a2 3cc4e9da
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -125,15 +125,7 @@
        <!-- Wearable Components -->
        <service android:name=".wear.WearPackageInstallerService"
                 android:permission="com.google.android.permission.INSTALL_WEARABLE_PACKAGES"
                 android:exported="true">
            <intent-filter>
                <action android:name="com.android.packageinstaller.wear.INSTALL_PACKAGE"/>
                <data android:scheme="content" android:mimeType="vnd.android.cursor.item/*"/>
            </intent-filter>
            <intent-filter>
                <action android:name="com.android.packageinstaller.wear.UNINSTALL_PACKAGE"/>
            </intent-filter>
        </service>
                 android:exported="true"/>

        <provider android:name=".wear.WearPackageIconProvider"
                  android:authorities="com.google.android.packageinstaller.wear.provider"
+30 −11
Original line number Diff line number Diff line
@@ -14,6 +14,10 @@
     limitations under the License.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <TextView
            android:id="@+id/header"
            android:layout_width="match_parent"
@@ -28,6 +32,21 @@
            android:fontFamily="sans-serif-condensed-light"
        />

        <TextView
            android:id="@+id/details"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:minHeight="@dimen/settings_header_base_height"
            android:layout_marginLeft="16dp"
            android:layout_marginTop="@dimen/settings_header_top_margin"
            android:maxLines="2"
            android:ellipsize="end"
            android:textColor="@color/permissions_settings_item_color"
            android:textSize="14sp"
            android:visibility="gone"
        />
    </LinearLayout>

    <android.support.wearable.view.WearableListView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/wheel"
+9 −9
Original line number Diff line number Diff line
@@ -123,16 +123,16 @@ public final class AppPermissionsFragmentWear extends TitledSettingsFragment {
        super.onViewCreated(view, savedInstanceState);
        if (mAppPermissions != null) {
            initializeLayout(mAdapter);
            bindHeader(mAppPermissions.getPackageInfo());
            mHeader.setText(R.string.app_permissions);
            mDetails.setText(R.string.no_permissions);
            if (mAdapter.getItemCount() == 0) {
                mDetails.setVisibility(View.VISIBLE);
                mWheel.setVisibility(View.GONE);
            } else {
                mDetails.setVisibility(View.GONE);
                mWheel.setVisibility(View.VISIBLE);
            }
        }

    private void bindHeader(PackageInfo packageInfo) {
        Activity activity = getActivity();
        PackageManager pm = activity.getPackageManager();
        ApplicationInfo appInfo = packageInfo.applicationInfo;
        CharSequence label = appInfo.loadLabel(pm);
        mHeader.setText(label);
    }

    private void initializePermissionGroupList() {
+15 −6
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.android.packageinstaller.permission.ui.wear.settings.ViewUtils;
@@ -46,6 +46,7 @@ public abstract class TitledSettingsFragment extends Fragment implements
    private int mInitialHeaderHeight;

    protected TextView mHeader;
    protected TextView mDetails;
    protected WearableListView mWheel;

    private int mCharLimitShortTitle;
@@ -114,6 +115,9 @@ public abstract class TitledSettingsFragment extends Fragment implements
        mHeader.addOnLayoutChangeListener(this);
        mHeader.addTextChangedListener(mHeaderTextWatcher);

        mDetails = (TextView) v.findViewById(R.id.details);
        mDetails.addOnLayoutChangeListener(this);

        mWheel.setAdapter(adapter);
        mWheel.addOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
@@ -134,13 +138,14 @@ public abstract class TitledSettingsFragment extends Fragment implements

        adjustHeaderSize();

        positionOnCircular(getContext(), mHeader, mWheel);
        positionOnCircular(getContext(), mHeader, mDetails, mWheel);
    }

    public void positionOnCircular(Context context, View header, final ViewGroup wheel) {
    public void positionOnCircular(Context context, View header, View details,
            final ViewGroup wheel) {
        if (ViewUtils.getIsCircular(context)) {
            FrameLayout.LayoutParams params =
                    (FrameLayout.LayoutParams) header.getLayoutParams();
            LinearLayout.LayoutParams params =
                    (LinearLayout.LayoutParams) header.getLayoutParams();
            params.topMargin = (int) context.getResources().getDimension(
                    R.dimen.settings_header_top_margin_circular);
            // Note that the margins are made symmetrical here. Since they're symmetrical we choose
@@ -152,10 +157,14 @@ public abstract class TitledSettingsFragment extends Fragment implements
            params.rightMargin = margin;
            params.gravity = Gravity.CENTER_HORIZONTAL;
            header.setLayoutParams(params);
            details.setLayoutParams(params);

            if (header instanceof TextView) {
                ((TextView) header).setGravity(Gravity.CENTER);
            }
            if (details instanceof TextView) {
                ((TextView) details).setGravity(Gravity.CENTER);
            }

            final int leftPadding = (int) context.getResources().getDimension(
                    R.dimen.round_content_padding_left);
@@ -209,7 +218,7 @@ public abstract class TitledSettingsFragment extends Fragment implements
        }
        mHeader.setMinHeight((int) height);

        FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mHeader.getLayoutParams();
        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mHeader.getLayoutParams();
        final Context context = getContext();
        if (!singleLine) {
            // Make the top margin a little bit smaller so there is more space for the title.
+8 −6
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ import android.os.Bundle;
 * installing/uninstalling.
 */
public class WearPackageArgs {
    private static final String KEY_PACKAGE_NAME =
            "com.google.android.clockwork.EXTRA_PACKAGE_NAME";
    private static final String KEY_ASSET_URI =
            "com.google.android.clockwork.EXTRA_ASSET_URI";
    private static final String KEY_START_ID =
@@ -45,16 +47,16 @@ public class WearPackageArgs {
            "com.google.android.clockwork.EXTRA_KEY_SHOULD_CHECK_GMS_DEPENDENCY";

    public static String getPackageName(Bundle b) {
        return b.getString(Intent.EXTRA_INSTALLER_PACKAGE_NAME);
        return b.getString(KEY_PACKAGE_NAME);
    }

    public static Uri getAssetUri(Bundle b) {
        return b.getParcelable(KEY_ASSET_URI);
    public static Bundle setPackageName(Bundle b, String packageName) {
        b.putString(KEY_PACKAGE_NAME, packageName);
        return b;
    }

    public static Bundle setAssetUri(Bundle b, Uri assetUri) {
        b.putParcelable(KEY_ASSET_URI, assetUri);
        return b;
    public static Uri getAssetUri(Bundle b) {
        return b.getParcelable(KEY_ASSET_URI);
    }

    public static Uri getPermUri(Bundle b) {
Loading