[20150716][Android][4.2.2_r1]USB plugin type

AC/USB/Wireless charging type checker

file: packages/apps/Settings/src/com/android/settings/Utils.java

function: getBatteryStatus

public static String getBatteryStatus(Resources res, Intent batteryChangedIntent) {
        final Intent intent = batteryChangedIntent;
        int plugType = intent.getIntExtra("plugged", 0);
        int status = intent.getIntExtra("status", BatteryManager.BATTERY_STATUS_UNKNOWN);
        String statusString;
        if (status == BatteryManager.BATTERY_STATUS_CHARGING) {
            statusString = res.getString(R.string.battery_info_status_charging);
            if (plugType > 0) {
                int resId;
                if (plugType == BatteryManager.BATTERY_PLUGGED_AC) {
                    resId = R.string.battery_info_status_charging_ac;
                } else if (plugType == BatteryManager.BATTERY_PLUGGED_USB) {
                    resId = R.string.battery_info_status_charging_usb;
                } else {
                    resId = R.string.battery_info_status_charging_wireless;
                }
                statusString = statusString + " " + res.getString(resId);
            }
        } else if (status == BatteryManager.BATTERY_STATUS_DISCHARGING) {
            statusString = res.getString(R.string.battery_info_status_discharging);
            else if (status == BatteryManager.BATTERY_STATUS_NOT_CHARGING) {
                statusString = res.getString(R.string.battery_info_status_not_charging);

            } else if (status == BatteryManager.BATTERY_STATUS_FULL) {
                statusString = res.getString(R.string.battery_info_status_full);
            } else {
                statusString = res.getString(R.string.battery_info_status_unknown);
            }
            return statusString;
        }

file: packages/apps/Settings/src/com/android/settings/BatteryInfo.java

function: mIntentReceiver

mStatus.setText(Utils.getBatteryStatus(getResources(), intent));