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

Commit 87cecc82 authored by Manish Kumar's avatar Manish Kumar
Browse files

Merge commit '8f189f71' into 123

Conflicts:
	core/res/res/values/config.xml
	core/res/res/values/symbols.xml

Change-Id: If26548afe5af9f98ef21bc78c13128b6481d6f0f
parents e9bf2de0 8f189f71
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
@@ -266,6 +266,13 @@ public class DownloadManager {
     */
    public final static int PAUSED_UNKNOWN = 4;

   /**
    * Value of {@link #COLUMN_REASON} when the download is paused by manual.
    *
    * @hide
    */
    public final static int PAUSED_BY_MANUAL = 5;

    /**
     * Broadcast intent action sent by the download manager when a download completes.
     */
@@ -865,6 +872,7 @@ public class DownloadManager {
                    parts.add(statusClause("=", Downloads.Impl.STATUS_WAITING_TO_RETRY));
                    parts.add(statusClause("=", Downloads.Impl.STATUS_WAITING_FOR_NETWORK));
                    parts.add(statusClause("=", Downloads.Impl.STATUS_QUEUED_FOR_WIFI));
                    parts.add(statusClause("=", Downloads.Impl.STATUS_PAUSED_BY_MANUAL));
                }
                if ((mStatusFlags & STATUS_SUCCESSFUL) != 0) {
                    parts.add(statusClause("=", Downloads.Impl.STATUS_SUCCESS));
@@ -1124,6 +1132,34 @@ public class DownloadManager {
        mResolver.update(mBaseUri, values, getWhereClauseForIds(ids), getWhereArgsForIds(ids));
    }

    /**
     * Pause the given running download by manual.
     *
     * @param id the ID of the download to be paused
     * @return the number of downloads actually updated
     * @hide
     */
    public int pauseDownload(long id) {
        ContentValues values = new ContentValues();
        values.put(Downloads.Impl.COLUMN_STATUS, Downloads.Impl.STATUS_PAUSED_BY_MANUAL);

        return mResolver.update(ContentUris.withAppendedId(mBaseUri, id), values, null, null);
    }

    /**
     * Resume the given paused download by manual.
     *
     * @param id the ID of the download to be resumed
     * @return the number of downloads actually updated
     * @hide
     */
    public int resumeDownload(long id) {
       ContentValues values = new ContentValues();
       values.put(Downloads.Impl.COLUMN_STATUS, Downloads.Impl.STATUS_RUNNING);

       return mResolver.update(ContentUris.withAppendedId(mBaseUri, id), values, null, null);
    }

    /**
     * Returns maximum size, in bytes, of downloads that may go over a mobile connection; or null if
     * there's no limit
@@ -1360,6 +1396,9 @@ public class DownloadManager {
                case Downloads.Impl.STATUS_QUEUED_FOR_WIFI:
                    return PAUSED_QUEUED_FOR_WIFI;

                case Downloads.Impl.STATUS_PAUSED_BY_MANUAL:
                    return PAUSED_BY_MANUAL;

                default:
                    return PAUSED_UNKNOWN;
            }
@@ -1415,6 +1454,7 @@ public class DownloadManager {
                case Downloads.Impl.STATUS_WAITING_TO_RETRY:
                case Downloads.Impl.STATUS_WAITING_FOR_NETWORK:
                case Downloads.Impl.STATUS_QUEUED_FOR_WIFI:
                case Downloads.Impl.STATUS_PAUSED_BY_MANUAL:
                    return STATUS_PAUSED;

                case Downloads.Impl.STATUS_SUCCESS:
+17 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.net.TrafficStats.MB_IN_BYTES;

import android.content.ContentResolver;
import android.content.Context;
import android.hardware.usb.UsbManager;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
@@ -380,6 +381,22 @@ public class StorageManager {
       }
    }

    /**
     * Switch USB Mass Storage (UMS) on the device.
     *
     * @hide
     */
    public void setUsbMassStorageEnabled(boolean enbale) {
        if (enbale && UsbManager.USB_FUNCTION_MASS_STORAGE
                    .equals(new UsbManager(null, null).getDefaultFunction())) {
            if(!isUsbMassStorageEnabled()) {
                enableUsbMassStorage();
            }
        } else if (isUsbMassStorageEnabled()) {
            disableUsbMassStorage();
        }
   }

    /**
     * Enables USB Mass Storage (UMS) on the device.
     *
+5 −0
Original line number Diff line number Diff line
@@ -592,6 +592,11 @@ public final class Downloads {
         */
        public static final int STATUS_QUEUED_FOR_WIFI = 196;

        /**
         * This download is paused by manual.
         */
        public static final int STATUS_PAUSED_BY_MANUAL = 197;

        /**
         * This download couldn't be completed due to insufficient storage
         * space.  Typically, this is because the SD card is full.
+19 −0
Original line number Diff line number Diff line
@@ -2417,6 +2417,25 @@ public final class Settings {
         */
        public static final String EGG_MODE = "egg_mode";

        /**
         * Whether wifi settings will connect to access point automatically
         * 0 = automatically
         * 1 = manually
         * @hide
         */
        public static final String WIFI_AUTO_CONNECT_TYPE = "wifi_auto_connect_type";

        /**
         * Whether wifi settings will connect to access point automatically when
         * network from mobile network transform to Wifi network
         * 0 = automatically
         * 1 = manually
         * 2 = always ask
         *
         * @hide
         */
        public static final String DATA_TO_WIFI_CONNECT_TYPE = "data_to_wifi_connect_type";

         /**
         * Settings to backup. This is here so that it's in the same place as the settings
         * keys and easy to update.
+91 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2013, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above
 *       copyright notice, this list of conditions and the following
 *       disclaimer in the documentation and/or other materials provided
 *       with the distribution.
 *     * Neither the name of The Linux Foundation nor the names of its
 *       contributors may be used to endorse or promote products derived
 *       from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package android.util;

import android.content.Context;

/**
 *@hide
 */
public class NativeTextHelper {

    /**
     * parse the string to current language.
     *
     * @param context base context of the application
     * @param originalString original string
     * @param defPackage the target package where the local language strings
     *            defined
     * @param originNamesId the id of the original string array.
     * @param localNamesId the id of the local string keys.
     * @return local language string
     */
    private static final String getLocalString(Context context, String originalString,
            String defPackage, int originNamesId, int localNamesId) {
        String[] origNames = context.getResources().getStringArray(originNamesId);
        String[] localNames = context.getResources().getStringArray(localNamesId);
        for (int i = 0; i < origNames.length; i++) {
            if (origNames[i].equalsIgnoreCase(originalString)) {
                return context.getString(context.getResources().getIdentifier(localNames[i],
                        "string", defPackage));
            }
        }
        return originalString;
    }

    /**
     * parse the string to current language string in public resources.
     *
     * @param context base context of the application
     * @param originalString original string
     * @param originNamesId the id of the original string array.
     * @param localNamesId the id of the local string keys.
     * @return local language string
     */
    public static final String getLocalString(Context context, String originalString,
            int originNamesId, int localNamesId) {
        return getLocalString(context, originalString, "android", originNamesId, localNamesId);
    }

    /**
     * parse the string to current language string in current resources.
     *
     * @param context base context of the application
     * @param originalString original string
     * @param originNamesId the id of the original string array.
     * @param localNamesId the id of the local string keys.
     * @return local language string
     */
    public static final String getInternalLocalString(Context context, String originalString,
            int originNamesId,
            int localNamesId) {
        return getLocalString(context, originalString, context.getPackageName(), originNamesId,
                localNamesId);
    }
}
Loading