Merge changes I4e45e5bb,Ibeba97eb,I8e8b892b into mnc-dr2-dev
* changes:
resolved conflicts for 7de7e0b0 to stage-aosp-master
BatteryService: Add Max charging voltage
Stop setting swappiness.
This commit is contained in:
committed by
Android (Google) Code Review
commit
5032e49f9e
@@ -108,6 +108,13 @@ public class BatteryManager {
|
||||
*/
|
||||
public static final String EXTRA_MAX_CHARGING_CURRENT = "max_charging_current";
|
||||
|
||||
/**
|
||||
* Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
|
||||
* Int value set to the maximum charging voltage supported by the charger in micro volts.
|
||||
* {@hide}
|
||||
*/
|
||||
public static final String EXTRA_MAX_CHARGING_VOLTAGE = "max_charging_voltage";
|
||||
|
||||
// values for "status" field in the ACTION_BATTERY_CHANGED Intent
|
||||
public static final int BATTERY_STATUS_UNKNOWN = 1;
|
||||
public static final int BATTERY_STATUS_CHARGING = 2;
|
||||
|
||||
@@ -23,6 +23,7 @@ public class BatteryProperties implements Parcelable {
|
||||
public boolean chargerUsbOnline;
|
||||
public boolean chargerWirelessOnline;
|
||||
public int maxChargingCurrent;
|
||||
public int maxChargingVoltage;
|
||||
public int batteryStatus;
|
||||
public int batteryHealth;
|
||||
public boolean batteryPresent;
|
||||
@@ -39,6 +40,7 @@ public class BatteryProperties implements Parcelable {
|
||||
chargerUsbOnline = other.chargerUsbOnline;
|
||||
chargerWirelessOnline = other.chargerWirelessOnline;
|
||||
maxChargingCurrent = other.maxChargingCurrent;
|
||||
maxChargingVoltage = other.maxChargingVoltage;
|
||||
batteryStatus = other.batteryStatus;
|
||||
batteryHealth = other.batteryHealth;
|
||||
batteryPresent = other.batteryPresent;
|
||||
@@ -58,6 +60,7 @@ public class BatteryProperties implements Parcelable {
|
||||
chargerUsbOnline = p.readInt() == 1 ? true : false;
|
||||
chargerWirelessOnline = p.readInt() == 1 ? true : false;
|
||||
maxChargingCurrent = p.readInt();
|
||||
maxChargingVoltage = p.readInt();
|
||||
batteryStatus = p.readInt();
|
||||
batteryHealth = p.readInt();
|
||||
batteryPresent = p.readInt() == 1 ? true : false;
|
||||
@@ -72,6 +75,7 @@ public class BatteryProperties implements Parcelable {
|
||||
p.writeInt(chargerUsbOnline ? 1 : 0);
|
||||
p.writeInt(chargerWirelessOnline ? 1 : 0);
|
||||
p.writeInt(maxChargingCurrent);
|
||||
p.writeInt(maxChargingVoltage);
|
||||
p.writeInt(batteryStatus);
|
||||
p.writeInt(batteryHealth);
|
||||
p.writeInt(batteryPresent ? 1 : 0);
|
||||
|
||||
@@ -20,6 +20,7 @@ import android.net.LocalSocket;
|
||||
import android.net.LocalSocketAddress;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Slog;
|
||||
|
||||
import libcore.io.IoUtils;
|
||||
import libcore.io.Streams;
|
||||
|
||||
@@ -91,32 +92,29 @@ public class InstallerConnection {
|
||||
}
|
||||
}
|
||||
|
||||
public int dexopt(String apkPath, int uid, boolean isPublic,
|
||||
String instructionSet, int dexoptNeeded, boolean bootComplete) {
|
||||
return dexopt(apkPath, uid, isPublic, "*", instructionSet, dexoptNeeded,
|
||||
false, false, null, bootComplete);
|
||||
public int dexopt(String apkPath, int uid, String instructionSet,
|
||||
int dexoptNeeded, int dexFlags) {
|
||||
return dexopt(apkPath, uid, "*", instructionSet, dexoptNeeded,
|
||||
null /*outputPath*/, dexFlags);
|
||||
}
|
||||
|
||||
public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName,
|
||||
String instructionSet, int dexoptNeeded, boolean vmSafeMode,
|
||||
boolean debuggable, String outputPath, boolean bootComplete) {
|
||||
public int dexopt(String apkPath, int uid, String pkgName, String instructionSet,
|
||||
int dexoptNeeded, String outputPath, int dexFlags) {
|
||||
StringBuilder builder = new StringBuilder("dexopt");
|
||||
builder.append(' ');
|
||||
builder.append(apkPath);
|
||||
builder.append(' ');
|
||||
builder.append(uid);
|
||||
builder.append(isPublic ? " 1" : " 0");
|
||||
builder.append(' ');
|
||||
builder.append(pkgName);
|
||||
builder.append(' ');
|
||||
builder.append(instructionSet);
|
||||
builder.append(' ');
|
||||
builder.append(dexoptNeeded);
|
||||
builder.append(vmSafeMode ? " 1" : " 0");
|
||||
builder.append(debuggable ? " 1" : " 0");
|
||||
builder.append(' ');
|
||||
builder.append(outputPath != null ? outputPath : "!");
|
||||
builder.append(bootComplete ? " 1" : " 0");
|
||||
builder.append(' ');
|
||||
builder.append(dexFlags);
|
||||
return execute(builder.toString());
|
||||
}
|
||||
|
||||
|
||||
@@ -476,8 +476,8 @@ public class ZygoteInit {
|
||||
final int dexoptNeeded = DexFile.getDexOptNeeded(
|
||||
classPathElement, "*", instructionSet, false /* defer */);
|
||||
if (dexoptNeeded != DexFile.NO_DEXOPT_NEEDED) {
|
||||
installer.dexopt(classPathElement, Process.SYSTEM_UID, false,
|
||||
instructionSet, dexoptNeeded, false /* boot complete */);
|
||||
installer.dexopt(classPathElement, Process.SYSTEM_UID, instructionSet,
|
||||
dexoptNeeded, 0 /*dexFlags*/);
|
||||
}
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
|
||||
@@ -121,6 +121,7 @@ public final class BatteryService extends SystemService {
|
||||
private int mLastBatteryTemperature;
|
||||
private boolean mLastBatteryLevelCritical;
|
||||
private int mLastMaxChargingCurrent;
|
||||
private int mLastMaxChargingVoltage;
|
||||
|
||||
private int mInvalidCharger;
|
||||
private int mLastInvalidCharger;
|
||||
@@ -325,6 +326,7 @@ public final class BatteryService extends SystemService {
|
||||
+ ", chargerUsbOnline=" + mBatteryProps.chargerUsbOnline
|
||||
+ ", chargerWirelessOnline=" + mBatteryProps.chargerWirelessOnline
|
||||
+ ", maxChargingCurrent" + mBatteryProps.maxChargingCurrent
|
||||
+ ", maxChargingVoltage" + mBatteryProps.maxChargingVoltage
|
||||
+ ", batteryStatus=" + mBatteryProps.batteryStatus
|
||||
+ ", batteryHealth=" + mBatteryProps.batteryHealth
|
||||
+ ", batteryPresent=" + mBatteryProps.batteryPresent
|
||||
@@ -356,6 +358,7 @@ public final class BatteryService extends SystemService {
|
||||
mBatteryProps.batteryVoltage != mLastBatteryVoltage ||
|
||||
mBatteryProps.batteryTemperature != mLastBatteryTemperature ||
|
||||
mBatteryProps.maxChargingCurrent != mLastMaxChargingCurrent ||
|
||||
mBatteryProps.maxChargingVoltage != mLastMaxChargingVoltage ||
|
||||
mInvalidCharger != mLastInvalidCharger)) {
|
||||
|
||||
if (mPlugType != mLastPlugType) {
|
||||
@@ -483,6 +486,7 @@ public final class BatteryService extends SystemService {
|
||||
mLastBatteryVoltage = mBatteryProps.batteryVoltage;
|
||||
mLastBatteryTemperature = mBatteryProps.batteryTemperature;
|
||||
mLastMaxChargingCurrent = mBatteryProps.maxChargingCurrent;
|
||||
mLastMaxChargingVoltage = mBatteryProps.maxChargingVoltage;
|
||||
mLastBatteryLevelCritical = mBatteryLevelCritical;
|
||||
mLastInvalidCharger = mInvalidCharger;
|
||||
}
|
||||
@@ -508,7 +512,7 @@ public final class BatteryService extends SystemService {
|
||||
intent.putExtra(BatteryManager.EXTRA_TECHNOLOGY, mBatteryProps.batteryTechnology);
|
||||
intent.putExtra(BatteryManager.EXTRA_INVALID_CHARGER, mInvalidCharger);
|
||||
intent.putExtra(BatteryManager.EXTRA_MAX_CHARGING_CURRENT, mBatteryProps.maxChargingCurrent);
|
||||
|
||||
intent.putExtra(BatteryManager.EXTRA_MAX_CHARGING_VOLTAGE, mBatteryProps.maxChargingVoltage);
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Sending ACTION_BATTERY_CHANGED. level:" + mBatteryProps.batteryLevel +
|
||||
", scale:" + BATTERY_SCALE + ", status:" + mBatteryProps.batteryStatus +
|
||||
@@ -521,7 +525,8 @@ public final class BatteryService extends SystemService {
|
||||
", USB powered:" + mBatteryProps.chargerUsbOnline +
|
||||
", Wireless powered:" + mBatteryProps.chargerWirelessOnline +
|
||||
", icon:" + icon + ", invalid charger:" + mInvalidCharger +
|
||||
", maxChargingCurrent:" + mBatteryProps.maxChargingCurrent);
|
||||
", maxChargingCurrent:" + mBatteryProps.maxChargingCurrent +
|
||||
", maxChargingVoltage:" + mBatteryProps.maxChargingVoltage);
|
||||
}
|
||||
|
||||
mHandler.post(new Runnable() {
|
||||
@@ -627,6 +632,7 @@ public final class BatteryService extends SystemService {
|
||||
pw.println(" USB powered: " + mBatteryProps.chargerUsbOnline);
|
||||
pw.println(" Wireless powered: " + mBatteryProps.chargerWirelessOnline);
|
||||
pw.println(" Max charging current: " + mBatteryProps.maxChargingCurrent);
|
||||
pw.println(" Max charging voltage: " + mBatteryProps.maxChargingVoltage);
|
||||
pw.println(" status: " + mBatteryProps.batteryStatus);
|
||||
pw.println(" health: " + mBatteryProps.batteryHealth);
|
||||
pw.println(" present: " + mBatteryProps.batteryPresent);
|
||||
|
||||
@@ -18707,8 +18707,6 @@ public final class ActivityManagerService extends ActivityManagerNative
|
||||
}
|
||||
}
|
||||
}
|
||||
Process.setSwappiness(app.pid,
|
||||
app.curSchedGroup <= Process.THREAD_GROUP_BG_NONINTERACTIVE);
|
||||
}
|
||||
}
|
||||
if (app.repForegroundActivities != app.foregroundActivities) {
|
||||
|
||||
@@ -31,6 +31,19 @@ import com.android.server.SystemService;
|
||||
public final class Installer extends SystemService {
|
||||
private static final String TAG = "Installer";
|
||||
|
||||
/* ***************************************************************************
|
||||
* IMPORTANT: These values are passed to native code. Keep them in sync with
|
||||
* frameworks/native/cmds/installd/installd.h
|
||||
* **************************************************************************/
|
||||
/** Application should be visible to everyone */
|
||||
public static final int DEXOPT_PUBLIC = 1 << 1;
|
||||
/** Application wants to run in VM safe mode */
|
||||
public static final int DEXOPT_SAFEMODE = 1 << 2;
|
||||
/** Application wants to allow debugging of its code */
|
||||
public static final int DEXOPT_DEBUGGABLE = 1 << 3;
|
||||
/** The system boot has finished */
|
||||
public static final int DEXOPT_BOOTCOMPLETE = 1 << 4;
|
||||
|
||||
private final InstallerConnection mInstaller;
|
||||
|
||||
public Installer(Context context) {
|
||||
@@ -75,39 +88,24 @@ public final class Installer extends SystemService {
|
||||
return mInstaller.execute(builder.toString());
|
||||
}
|
||||
|
||||
public int dexopt(String apkPath, int uid, boolean isPublic,
|
||||
String instructionSet, int dexoptNeeded) {
|
||||
return dexopt(apkPath, uid, isPublic, instructionSet, dexoptNeeded, true);
|
||||
}
|
||||
|
||||
public int dexopt(String apkPath, int uid, boolean isPublic,
|
||||
String instructionSet, int dexoptNeeded, boolean bootComplete) {
|
||||
public int dexopt(String apkPath, int uid, String instructionSet,
|
||||
int dexoptNeeded, int dexFlags) {
|
||||
if (!isValidInstructionSet(instructionSet)) {
|
||||
Slog.e(TAG, "Invalid instruction set: " + instructionSet);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return mInstaller.dexopt(apkPath, uid, isPublic, instructionSet, dexoptNeeded,
|
||||
bootComplete);
|
||||
return mInstaller.dexopt(apkPath, uid, instructionSet, dexoptNeeded, dexFlags);
|
||||
}
|
||||
|
||||
public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName,
|
||||
String instructionSet, int dexoptNeeded, boolean vmSafeMode,
|
||||
boolean debuggable, @Nullable String outputPath) {
|
||||
return dexopt(apkPath, uid, isPublic, pkgName, instructionSet, dexoptNeeded, vmSafeMode,
|
||||
debuggable, outputPath, true);
|
||||
}
|
||||
|
||||
public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName,
|
||||
String instructionSet, int dexoptNeeded, boolean vmSafeMode,
|
||||
boolean debuggable, @Nullable String outputPath, boolean bootComplete) {
|
||||
public int dexopt(String apkPath, int uid, String pkgName, String instructionSet,
|
||||
int dexoptNeeded, @Nullable String outputPath, int dexFlags) {
|
||||
if (!isValidInstructionSet(instructionSet)) {
|
||||
Slog.e(TAG, "Invalid instruction set: " + instructionSet);
|
||||
return -1;
|
||||
}
|
||||
return mInstaller.dexopt(apkPath, uid, isPublic, pkgName,
|
||||
instructionSet, dexoptNeeded, vmSafeMode,
|
||||
debuggable, outputPath, bootComplete);
|
||||
return mInstaller.dexopt(apkPath, uid, pkgName, instructionSet, dexoptNeeded,
|
||||
outputPath, dexFlags);
|
||||
}
|
||||
|
||||
public int idmap(String targetApkPath, String overlayApkPath, int uid) {
|
||||
|
||||
@@ -35,6 +35,10 @@ import java.util.List;
|
||||
|
||||
import dalvik.system.DexFile;
|
||||
|
||||
import static com.android.server.pm.Installer.DEXOPT_BOOTCOMPLETE;
|
||||
import static com.android.server.pm.Installer.DEXOPT_DEBUGGABLE;
|
||||
import static com.android.server.pm.Installer.DEXOPT_PUBLIC;
|
||||
import static com.android.server.pm.Installer.DEXOPT_SAFEMODE;
|
||||
import static com.android.server.pm.InstructionSets.getAppDexInstructionSets;
|
||||
import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets;
|
||||
|
||||
@@ -177,9 +181,13 @@ final class PackageDexOptimizer {
|
||||
+ " vmSafeMode=" + vmSafeMode + " debuggable=" + debuggable
|
||||
+ " oatDir = " + oatDir + " bootComplete=" + bootComplete);
|
||||
final int sharedGid = UserHandle.getSharedAppGid(pkg.applicationInfo.uid);
|
||||
final int dexFlags =
|
||||
(!pkg.isForwardLocked() ? DEXOPT_PUBLIC : 0)
|
||||
| (vmSafeMode ? DEXOPT_SAFEMODE : 0)
|
||||
| (debuggable ? DEXOPT_DEBUGGABLE : 0)
|
||||
| (bootComplete ? DEXOPT_BOOTCOMPLETE : 0);
|
||||
final int ret = mPackageManagerService.mInstaller.dexopt(path, sharedGid,
|
||||
!pkg.isForwardLocked(), pkg.packageName, dexCodeInstructionSet,
|
||||
dexoptNeeded, vmSafeMode, debuggable, oatDir, bootComplete);
|
||||
pkg.packageName, dexCodeInstructionSet, dexoptNeeded, oatDir, dexFlags);
|
||||
|
||||
// Dex2oat might fail due to compiler / verifier errors. We soldier on
|
||||
// regardless, and attempt to interpret the app as a safety net.
|
||||
|
||||
@@ -74,6 +74,7 @@ import static com.android.internal.app.IntentForwarderActivity.FORWARD_INTENT_TO
|
||||
import static com.android.internal.content.NativeLibraryHelper.LIB64_DIR_NAME;
|
||||
import static com.android.internal.content.NativeLibraryHelper.LIB_DIR_NAME;
|
||||
import static com.android.internal.util.ArrayUtils.appendInt;
|
||||
import static com.android.server.pm.Installer.DEXOPT_PUBLIC;
|
||||
import static com.android.server.pm.InstructionSets.getAppDexInstructionSets;
|
||||
import static com.android.server.pm.InstructionSets.getDexCodeInstructionSet;
|
||||
import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets;
|
||||
@@ -1982,7 +1983,8 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
int dexoptNeeded = DexFile.getDexOptNeeded(lib, null, dexCodeInstructionSet, false);
|
||||
if (dexoptNeeded != DexFile.NO_DEXOPT_NEEDED) {
|
||||
alreadyDexOpted.add(lib);
|
||||
mInstaller.dexopt(lib, Process.SYSTEM_UID, true, dexCodeInstructionSet, dexoptNeeded, false);
|
||||
mInstaller.dexopt(lib, Process.SYSTEM_UID, dexCodeInstructionSet,
|
||||
dexoptNeeded, DEXOPT_PUBLIC /*dexFlags*/);
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
Slog.w(TAG, "Library not found: " + lib);
|
||||
@@ -2030,7 +2032,8 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
try {
|
||||
int dexoptNeeded = DexFile.getDexOptNeeded(path, null, dexCodeInstructionSet, false);
|
||||
if (dexoptNeeded != DexFile.NO_DEXOPT_NEEDED) {
|
||||
mInstaller.dexopt(path, Process.SYSTEM_UID, true, dexCodeInstructionSet, dexoptNeeded, false);
|
||||
mInstaller.dexopt(path, Process.SYSTEM_UID, dexCodeInstructionSet,
|
||||
dexoptNeeded, DEXOPT_PUBLIC /*dexFlags*/);
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
Slog.w(TAG, "Jar not found: " + path);
|
||||
@@ -12451,7 +12454,7 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
int result = mPackageDexOptimizer
|
||||
.performDexOpt(pkg, null /* instruction sets */, false /* forceDex */,
|
||||
false /* defer */, false /* inclDependencies */,
|
||||
true /* boot complete */);
|
||||
true /*bootComplete*/);
|
||||
if (result == PackageDexOptimizer.DEX_OPT_FAILED) {
|
||||
res.setError(INSTALL_FAILED_DEXOPT, "Dexopt failed for " + pkg.codePath);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user