Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QS Tile: increase DEFAULT_MAX_BOUND to 6 #16

Open
wants to merge 8 commits into
base: n7x
Choose a base branch
from
7 changes: 7 additions & 0 deletions core/res/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1949,6 +1949,13 @@
android:description="@string/permdesc_getPackageSize"
android:protectionLevel="normal" />

<!-- @hide Allows an application to change the package signature as
seen by applications -->
<permission android:name="android.permission.FAKE_PACKAGE_SIGNATURE"
android:protectionLevel="dangerous"
android:label="@string/permlab_fakePackageSignature"
android:description="@string/permdesc_fakePackageSignature" />

<!-- @deprecated No longer useful, see
{@link android.content.pm.PackageManager#addPackageToPreferred}
for details. -->
Expand Down
5 changes: 5 additions & 0 deletions core/res/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4466,4 +4466,9 @@

<!-- Label used by Telephony code, assigned as the display name for conference calls [CHAR LIMIT=60] -->
<string name="conference_call">Conference Call</string>

<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_fakePackageSignature">Spoof package signature</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_fakePackageSignature">Allows the app to pretend to be a different app. Malicious applications might be able to use this to access private application data. Grant this permission with caution only!</string>
</resources>
25 changes: 25 additions & 0 deletions packages/SystemUI/res/drawable/ic_qs_reboot.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 AICP Project

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

http://www.apache.org/licenses/LICENSE-2.0

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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M17.65 6.35C16.2 4.9 14.21 4 12 4 7.58 4 4.01 7.58 4.01 12c0 4.42 3.57 8 7.99 8 3.73 0 6.84 -2.55 7.73 -6l-2.08 0C16.83 16.33 14.61 18 12 18 8.69 18 6 15.31 6 12 6 8.69 8.69 6 12 6c1.66 0 3.14 0.69 4.22 1.78L13 11l7 0 0 -7 -2.35 2.35z" />
</vector>
28 changes: 28 additions & 0 deletions packages/SystemUI/res/drawable/ic_qs_reboot_recovery.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 AICP Project

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

http://www.apache.org/licenses/LICENSE-2.0

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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M6.8 3.3C6.62 3.3 6.47 3.45 6.47 3.63l0 0.63A2.6 2.6 0 0 0 5.97 4.47L5.51 4.02C5.39 3.89 5.18 3.89 5.06 4.02L4.5 4.58C4.37 4.71 4.37 4.91 4.5 5.04L4.94 5.49A2.6 2.6 0 0 0 4.73 6L4.1 6C3.92 6 3.78 6.14 3.78 6.32l0 0.8c0 0.18 0.14 0.32 0.32 0.32l0.61 0A2.6 2.6 0 0 0 4.92 7.98L4.5 8.4c-0.13 0.13 -0.13 0.33 0 0.46l0.56 0.56c0.13 0.13 0.33 0.13 0.46 0l0.4 -0.4a2.6 2.6 0 0 0 0.55 0.24l0 0.57c0 0.18 0.15 0.29 0.33 0.29l0.79 0c0.18 0 0.33 -0.11 0.33 -0.29l0 -0.56a2.6 2.6 0 0 0 0.55 -0.2l0.39 0.39c0.13 0.13 0.33 0.13 0.46 0L9.89 8.9c0.17 -0.13 0.17 -0.33 0 -0.46L9.49 8.05A2.6 2.6 0 0 0 9.72 7.48l0.54 0c0.2 0 0.4 -0.15 0.4 -0.33l0 -0.79c0 -0.18 -0.2 -0.33 -0.4 -0.33l-0.56 0A2.6 2.6 0 0 0 9.51 5.5L9.93 5.08c0.13 -0.12 0.13 -0.33 0 -0.46L9.37 4.06C9.24 3.93 9.04 3.93 8.91 4.06L8.47 4.49A2.6 2.6 0 0 0 7.95 4.28l0 -0.62C7.95 3.48 7.8 3.34 7.62 3.34L6.83 3.34 6.8 3.3Zm0.42 2.2a1.2 1.2 0 0 1 1.2 1.2 1.2 1.2 0 0 1 -1.2 1.2 1.2 1.2 0 0 1 -1.2 -1.2 1.2 1.2 0 0 1 1.2 -1.2z" />
<path
android:fillColor="#FFFFFFFF"
android:pathData="M16 7.6c-0.2 0 -0.5 0.14 -0.6 0.38L15 9.08a4.9 4.9 0 0 0 -1.1 0.01l-0.5 -1.1c0 -0.18 -0.2 -0.3 -0.4 -0.35 0 0 -0.1 0.01 -0.2 0.05L11.4 8.26C11.1 8.39 11 8.75 11.1 9.06l0.4 1.1a4.9 4.9 0 0 0 -0.7 0.8l-1.2 -0.4c-0.31 -0.1 -0.67 0 -0.8 0.3l-0.57 1.4c-0.13 0.3 0.02 0.6 0.33 0.8l1.1 0.4a4.9 4.9 0 0 0 -0.01 1.1l-1.1 0.4c-0.32 0.2 -0.47 0.5 -0.34 0.8l0.58 1.4c0.13 0.3 0.48 0.5 0.8 0.3l1.1 -0.4a4.9 4.9 0 0 0 0.7 0.8l-0.4 1c-0.1 0.3 0 0.7 0.3 0.8l1.4 0.6c0.3 0.1 0.7 0 0.8 -0.3l0.4 -1a4.9 4.9 0 0 0 1.2 0l0.4 1c0.1 0.3 0.5 0.4 0.8 0.3l1.4 -0.6c0.3 -0.1 0.4 -0.5 0.3 -0.8l-0.4 -1a4.9 4.9 0 0 0 0.8 -0.8l1 0.4c0.3 0.2 0.6 0 0.8 -0.3l0.5 -1.4c0.2 -0.3 0 -0.6 -0.3 -0.8l-1 -0.4a4.9 4.9 0 0 0 0 -1.1l1 -0.4c0.3 -0.2 0.5 -0.5 0.3 -0.8l-0.7 -1.5c-0.1 -0.3 -0.4 -0.4 -0.7 -0.3l-1.1 0.4a4.9 4.9 0 0 0 -0.8 -0.7l0.5 -1.1c0.1 -0.32 0 -0.67 -0.4 -0.8l-1.3 -0.58c0 -0.04 -0.1 -0.05 -0.2 -0.05zm-1.3 4.1a2.3 2.3 0 0 1 2 1.4 2.3 2.3 0 0 1 -1.2 2.9 2.3 2.3 0 0 1 -3 -1.2 2.3 2.3 0 0 1 1.3 -3 2.3 2.3 0 0 1 0.9 -0.1z" />
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* Runs the day-to-day operations of which tiles should be bound and when.
*/
public class TileServices extends IQSService.Stub {
static final int DEFAULT_MAX_BOUND = 3;
static final int DEFAULT_MAX_BOUND = 6;
static final int REDUCED_MAX_BOUND = 1;

private final ArrayMap<CustomTile, TileServiceManager> mServices = new ArrayMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
import com.android.internal.util.FastXmlSerializer;
import com.android.internal.util.XmlUtils;
import com.android.server.am.BatteryStatsService;
import com.android.server.utils.ServiceHelper;

import org.cyanogenmod.internal.util.PackageManagerUtils;

Expand Down Expand Up @@ -1353,6 +1354,7 @@ public void onStart() {
mLightEnabled = mDeepEnabled = getContext().getResources().getBoolean(
com.android.internal.R.bool.config_enableAutoPowerModes) &&
PackageManagerUtils.isAppInstalled(getContext(), "com.google.android.gms");
ServiceHelper.isGMSInstalled(getContext());
SystemConfig sysConfig = SystemConfig.getInstance();
ArraySet<String> allowPowerExceptIdle = sysConfig.getAllowInPowerSaveExceptIdle();
for (int i=0; i<allowPowerExceptIdle.size(); i++) {
Expand Down
3 changes: 1 addition & 2 deletions services/core/java/com/android/server/ServiceWatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ public static ArrayList<HashSet<Signature>> getSignatureSets(Context context,
String pkg = initialPackageNames.get(i);
try {
HashSet<Signature> set = new HashSet<Signature>();
Signature[] sigs = pm.getPackageInfo(pkg, PackageManager.MATCH_SYSTEM_ONLY
| PackageManager.GET_SIGNATURES).signatures;
Signature[] sigs = pm.getPackageInfo(pkg, PackageManager.GET_SIGNATURES).signatures;
set.addAll(Arrays.asList(sigs));
sigSets.add(set);
} catch (NameNotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3174,8 +3174,27 @@ private PackageInfo generatePackageInfo(PackageSetting ps, int flags, int userId
? Collections.<String>emptySet() : permissionsState.getPermissions(userId);
final PackageUserState state = ps.readUserState(userId);

return PackageParser.generatePackageInfo(p, gids, flags,
ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId);
return mayFakeSignature(p, PackageParser.generatePackageInfo(p, gids, flags,
ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId),
permissions);
}

private PackageInfo mayFakeSignature(PackageParser.Package p, PackageInfo pi,
Set<String> permissions) {
try {
if (permissions.contains("android.permission.FAKE_PACKAGE_SIGNATURE")
&& p.applicationInfo.targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1
&& p.mAppMetaData != null) {
String sig = p.mAppMetaData.getString("fake-signature");
if (sig != null) {
pi.signatures = new Signature[] {new Signature(sig)};
}
}
} catch (Throwable t) {
// We should never die because of any failures, this is system code!
Log.w("PackageManagerService.FAKE_PACKAGE_SIGNATURE", t);
}
return pi;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.IndentingPrintWriter;
import com.android.server.SystemService;
import com.android.server.utils.ServiceHelper;

import org.cyanogenmod.internal.util.PackageManagerUtils;

Expand Down Expand Up @@ -193,6 +194,7 @@ public void onStart() {
mAppIdleEnabled = getContext().getResources().getBoolean(
com.android.internal.R.bool.config_enableAutoPowerModes) &&
PackageManagerUtils.isAppInstalled(getContext(), "com.google.android.gms");
ServiceHelper.isGMSInstalled(getContext());
if (mAppIdleEnabled) {
IntentFilter deviceStates = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
deviceStates.addAction(BatteryManager.ACTION_DISCHARGING);
Expand Down
4 changes: 2 additions & 2 deletions telephony/java/android/telephony/CarrierConfigManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1282,8 +1282,8 @@ public CarrierConfigManager() {
sDefaults.putBoolean(KEY_DROP_VIDEO_CALL_WHEN_ANSWERING_AUDIO_CALL_BOOL, false);
sDefaults.putBoolean(KEY_ALLOW_MERGE_WIFI_CALLS_WHEN_VOWIFI_OFF_BOOL, true);
sDefaults.putBoolean(KEY_ALLOW_ADD_CALL_DURING_VIDEO_CALL_BOOL, true);
sDefaults.putBoolean(KEY_WIFI_CALLS_CAN_BE_HD_AUDIO, true);
sDefaults.putBoolean(KEY_VIDEO_CALLS_CAN_BE_HD_AUDIO, true);
sDefaults.putBoolean(KEY_WIFI_CALLS_CAN_BE_HD_AUDIO, false);
sDefaults.putBoolean(KEY_VIDEO_CALLS_CAN_BE_HD_AUDIO, false);

sDefaults.putStringArray(KEY_IMS_REASONINFO_MAPPING_STRING_ARRAY, null);
sDefaults.putBoolean(KEY_ENHANCED_4G_LTE_TITLE_VARIANT_BOOL, false);
Expand Down