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

Commit 27826abb authored by android-build-team Robot's avatar android-build-team Robot
Browse files

release-request-dabd8cf7-7af2-48e9-a296-ccc6a71cc25d-for-git_oc-m2-release-432...

release-request-dabd8cf7-7af2-48e9-a296-ccc6a71cc25d-for-git_oc-m2-release-4328410 snap-temp-L55300000101694322

Change-Id: Icf719c372fb0d38bed94adc36afdbccef9c4d970
parents f95168d6 801cc87c
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -188,22 +188,27 @@ public final class BluetoothDevicePreference extends GearPreference implements
    }

    void onClicked() {
        Context context = getContext();
        int bondState = mCachedDevice.getBondState();

        final MetricsFeatureProvider metricsFeatureProvider =
                FeatureFactory.getFactory(getContext()).getMetricsFeatureProvider();
                FeatureFactory.getFactory(context).getMetricsFeatureProvider();

        if (mCachedDevice.isConnected()) {
            metricsFeatureProvider.action(getContext(),
            metricsFeatureProvider.action(context,
                    MetricsEvent.ACTION_SETTINGS_BLUETOOTH_DISCONNECT);
            askDisconnect();
        } else if (bondState == BluetoothDevice.BOND_BONDED) {
            metricsFeatureProvider.action(getContext(),
            metricsFeatureProvider.action(context,
                    MetricsEvent.ACTION_SETTINGS_BLUETOOTH_CONNECT);
            mCachedDevice.connect(true);
        } else if (bondState == BluetoothDevice.BOND_NONE) {
            metricsFeatureProvider.action(getContext(),
            metricsFeatureProvider.action(context,
                    MetricsEvent.ACTION_SETTINGS_BLUETOOTH_PAIR);
            if (!mCachedDevice.hasHumanReadableName()) {
                metricsFeatureProvider.action(context,
                        MetricsEvent.ACTION_SETTINGS_BLUETOOTH_PAIR_DEVICES_WITHOUT_NAMES);
            }
            pair();
        }
    }
+11 −0
Original line number Diff line number Diff line
@@ -460,6 +460,17 @@ public class DashboardData {
                    // Only check title and summary for dashboard tile
                    return TextUtils.equals(localTile.title, targetTile.title)
                            && TextUtils.equals(localTile.summary, targetTile.summary);
                case TYPE_SUGGESTION_CONDITION_CONTAINER:
                    // If entity is suggestion and contains remote view, force refresh
                    final List entities = (List) entity;
                    if (!entities.isEmpty()) {
                        Object firstEntity = entities.get(0);
                        if (firstEntity instanceof Tile
                                && ((Tile) firstEntity).remoteViews != null) {
                            return false;
                        }
                    }
                    // Otherwise Fall through to default
                default:
                    return entity == null ? targetItem.entity == null
                            : entity.equals(targetItem.entity);
+3 −0
Original line number Diff line number Diff line
@@ -230,6 +230,9 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment

    @VisibleForTesting
    boolean tintTileIcon(Tile tile) {
        if (tile.icon == null) {
            return false;
        }
        // First check if the tile has set the icon tintable metadata.
        final Bundle metadata = tile.metaData;
        if (metadata != null
+3 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ import com.android.settings.dashboard.DashboardAdapter.DashboardItemHolder;
import com.android.settings.dashboard.DashboardAdapter.IconCache;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.drawer.Tile;
import com.android.settingslib.drawer.TileUtils;

import java.util.List;
import java.util.Objects;

@@ -73,6 +75,7 @@ public class SuggestionAdapter extends RecyclerView.Adapter<DashboardItemHolder>
            mSuggestionsShownLogged.add(suggestionId);
        }
        if (suggestion.remoteViews != null) {
            TileUtils.updateTileUsingSummaryUri(mContext, suggestion);
            final ViewGroup itemView = (ViewGroup) holder.itemView;
            itemView.removeAllViews();
            itemView.addView(suggestion.remoteViews.apply(itemView.getContext(), itemView));
+76 −0
Original line number Diff line number Diff line
/**
 * Copyright (C) 2017 The Android Open Source Project
 *
 * <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of the License at
 *
 * <p>http://www.apache.org/licenses/LICENSE-2.0
 *
 * <p>Unless required by applicable law or agreed to in writing, software distributed under the
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.settings.deletionhelper;

import android.content.ContentResolver;
import android.content.Context;
import android.provider.Settings;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import android.text.format.DateUtils;
import android.text.format.Formatter;

import com.android.settings.R;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.core.AbstractPreferenceController;

/**
 * Handles the wall of text which appears below the options in the Storage Management settings drill
 * down.
 */
public class AutomaticStorageManagerDescriptionPreferenceController
        extends AbstractPreferenceController implements PreferenceControllerMixin {
    private static final String KEY_FREED = "freed_bytes";

    public AutomaticStorageManagerDescriptionPreferenceController(Context context) {
        super(context);
    }

    @Override
    public boolean isAvailable() {
        return true;
    }

    @Override
    public String getPreferenceKey() {
        return KEY_FREED;
    }

    @Override
    public void displayPreference(PreferenceScreen screen) {
        Preference preference = screen.findPreference(getPreferenceKey());
        final Context context = preference.getContext();
        ContentResolver cr = context.getContentResolver();
        long freedBytes =
                Settings.Secure.getLong(
                        cr, Settings.Secure.AUTOMATIC_STORAGE_MANAGER_BYTES_CLEARED, 0);
        long lastRunMillis =
                Settings.Secure.getLong(cr, Settings.Secure.AUTOMATIC_STORAGE_MANAGER_LAST_RUN, 0);
        if (freedBytes == 0 || lastRunMillis == 0 || !isStorageManagerEnabled(cr)) {
            preference.setSummary(R.string.automatic_storage_manager_text);
        } else {
            preference.setSummary(
                    context.getString(
                            R.string.automatic_storage_manager_freed_bytes,
                            Formatter.formatFileSize(context, freedBytes),
                            DateUtils.formatDateTime(
                                    context, lastRunMillis, DateUtils.FORMAT_SHOW_DATE)));
        }
    }

    private boolean isStorageManagerEnabled(ContentResolver cr) {
        return Settings.Secure.getInt(cr, Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED, 0)
                != 0;
    }
}
Loading