Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/java/android/content/pm/PackageInstaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -2082,6 +2082,7 @@ public long getSize() {

/**
* Get the value set in {@link SessionParams#setOriginatingUri(Uri)}.
* Note: This value will only be non-null for the owner of the session.
*/
public @Nullable Uri getOriginatingUri() {
return originatingUri;
Expand All @@ -2096,6 +2097,7 @@ public int getOriginatingUid() {

/**
* Get the value set in {@link SessionParams#setReferrerUri(Uri)}
* Note: This value will only be non-null for the owner of the session.
*/
public @Nullable Uri getReferrerUri() {
return referrerUri;
Expand Down
8 changes: 8 additions & 0 deletions core/res/res/values/colt_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,12 @@
<integer name="config_sysCPUTempMultiplier">1</integer>
<integer name="config_sysBatteryTempMultiplier">1</integer>

<!-- Whether device has physical tri state switch -->
<bool name="config_hasAlertSlider">false</bool>

<!-- The location of the devices physical tri state switch
0: Left side
1: Right side -->
<integer name="config_alertSliderLocation">0</integer>

</resources>
4 changes: 4 additions & 0 deletions core/res/res/values/colt_symbols.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@
<java-symbol type="string" name="config_sysGPULoad" />
<java-symbol type="integer" name="config_sysCPUTempMultiplier" />
<java-symbol type="integer" name="config_sysBatteryTempMultiplier" />

<!-- Alert slider. -->
<java-symbol type="bool" name="config_hasAlertSlider" />
<java-symbol type="integer" name="config_alertSliderLocation" />

<!-- SystemUI Restart -->
<java-symbol type="string" name="systemui_restart_title" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public class BugreportManagerTest {
private Handler mHandler;
private Executor mExecutor;
private BugreportManager mBrm;
private File mBugreportFile;
private File mScreenshotFile;
private ParcelFileDescriptor mBugreportFd;
private ParcelFileDescriptor mScreenshotFd;

Expand All @@ -73,8 +75,10 @@ public void setup() throws Exception {
};

mBrm = getBugreportManager();
mBugreportFd = parcelFd("bugreport_" + name.getMethodName(), ".zip");
mScreenshotFd = parcelFd("screenshot_" + name.getMethodName(), ".png");
mBugreportFile = createTempFile("bugreport_" + name.getMethodName(), ".zip");
mScreenshotFile = createTempFile("screenshot_" + name.getMethodName(), ".png");
mBugreportFd = parcelFd(mBugreportFile);
mScreenshotFd = parcelFd(mScreenshotFile);

getPermissions();
}
Expand Down Expand Up @@ -120,6 +124,21 @@ public void normalFlow_interactive() throws Exception {
assertFdsAreClosed(mBugreportFd);
}

@Test
public void normalFlow_full() throws Exception {
BugreportCallbackImpl callback = new BugreportCallbackImpl();
mBrm.startBugreport(mBugreportFd, mScreenshotFd, full(), mExecutor, callback);

waitTillDoneOrTimeout(callback);
assertThat(callback.isDone()).isTrue();
assertThat(callback.getErrorCode()).isEqualTo(
BugreportCallback.BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT);
// bugreport and screenshot files should be empty when user consent timed out.
assertThat(mBugreportFile.length()).isEqualTo(0);
assertThat(mScreenshotFile.length()).isEqualTo(0);
assertFdsAreClosed(mBugreportFd, mScreenshotFd);
}

@Test
public void simultaneousBugreportsNotAllowed() throws Exception {
// Start bugreport #1
Expand All @@ -129,9 +148,10 @@ public void simultaneousBugreportsNotAllowed() throws Exception {
// Before #1 is done, try to start #2.
assertThat(callback.isDone()).isFalse();
BugreportCallbackImpl callback2 = new BugreportCallbackImpl();
ParcelFileDescriptor bugreportFd2 = parcelFd("bugreport_2_" + name.getMethodName(), ".zip");
ParcelFileDescriptor screenshotFd2 =
parcelFd("screenshot_2_" + name.getMethodName(), ".png");
File bugreportFile2 = createTempFile("bugreport_2_" + name.getMethodName(), ".zip");
File screenshotFile2 = createTempFile("screenshot_2_" + name.getMethodName(), ".png");
ParcelFileDescriptor bugreportFd2 = parcelFd(bugreportFile2);
ParcelFileDescriptor screenshotFd2 = parcelFd(screenshotFile2);
mBrm.startBugreport(bugreportFd2, screenshotFd2, wifi(), mExecutor, callback2);
Thread.sleep(500 /* .5s */);

Expand Down Expand Up @@ -271,12 +291,16 @@ public static BugreportManager getBugreportManager() {
return bm;
}

private static ParcelFileDescriptor parcelFd(String prefix, String extension) throws Exception {
File f = File.createTempFile(prefix, extension);
private static File createTempFile(String prefix, String extension) throws Exception {
final File f = File.createTempFile(prefix, extension);
f.setReadable(true, true);
f.setWritable(true, true);
f.deleteOnExit();
return f;
}

return ParcelFileDescriptor.open(f,
private static ParcelFileDescriptor parcelFd(File file) throws Exception {
return ParcelFileDescriptor.open(file,
ParcelFileDescriptor.MODE_WRITE_ONLY | ParcelFileDescriptor.MODE_APPEND);
}

Expand Down Expand Up @@ -342,4 +366,13 @@ private static BugreportParams wifi() {
private static BugreportParams interactive() {
return new BugreportParams(BugreportParams.BUGREPORT_MODE_INTERACTIVE);
}

/*
* Returns a {@link BugreportParams} for full bugreport that includes a screenshot.
*
* <p> This can take on the order of minutes to finish
*/
private static BugreportParams full() {
return new BugreportParams(BugreportParams.BUGREPORT_MODE_FULL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
Expand Down Expand Up @@ -392,13 +391,9 @@ private synchronized void setNiNotification(GpsNiNotification notif) {
mNiNotificationBuilder.setDefaults(0);
}

// if not to popup dialog immediately, pending intent will open the dialog
Intent intent = !mPopupImmediately ? getDlgIntent(notif) : new Intent();
PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, intent, 0);
mNiNotificationBuilder.setTicker(getNotifTicker(notif, mContext))
.setContentTitle(title)
.setContentText(message)
.setContentIntent(pi);
.setContentText(message);

notificationManager.notifyAsUser(null, notif.notificationId, mNiNotificationBuilder.build(),
UserHandle.ALL);
Expand Down
29 changes: 29 additions & 0 deletions packages/SystemUI/res/drawable/dialog_tri_state_down_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 CypherOS

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.
-->
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="#ff1d1d1d" />
<corners
android:topLeftRadius="@dimen/tri_state_down_top_left_radius"
android:topRightRadius="@dimen/tri_state_down_top_right_radius"
android:bottomLeftRadius="@dimen/tri_state_down_bottom_left_radius"
android:bottomRightRadius="@dimen/tri_state_down_bottom_right_radius" />
</shape>
</item>
</layer-list>
29 changes: 29 additions & 0 deletions packages/SystemUI/res/drawable/dialog_tri_state_middle_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 CypherOS

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.
-->
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="#ff1d1d1d" />
<corners
android:topLeftRadius="@dimen/tri_state_mid_top_left_radius"
android:topRightRadius="@dimen/tri_state_mid_top_right_radius"
android:bottomLeftRadius="@dimen/tri_state_mid_bottom_left_radius"
android:bottomRightRadius="@dimen/tri_state_mid_bottom_right_radius" />
</shape>
</item>
</layer-list>
29 changes: 29 additions & 0 deletions packages/SystemUI/res/drawable/dialog_tri_state_navigation_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 CypherOS

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.
-->
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="#e6208de3" />
<corners
android:topLeftRadius="10.0dip"
android:topRightRadius="10.0dip"
android:bottomLeftRadius="10.0dip"
android:bottomRightRadius="10.0dip" />
</shape>
</item>
</layer-list>
27 changes: 27 additions & 0 deletions packages/SystemUI/res/drawable/dialog_tri_state_triangle_right.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 CypherOS

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.
-->
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/shape_id" android:height="42.0px">
<rotate android:layout_width="fill_parent" android:layout_height="wrap_content" android:fromDegrees="45.0" android:pivotX="0.0%" android:pivotY="0.0%">
<shape android:shape="rectangle">
<solid android:color="#ff000000" />
<size android:height="29.695984px" android:width="29.695984px" />
</shape>
</rotate>
</item>
</layer-list>
27 changes: 27 additions & 0 deletions packages/SystemUI/res/drawable/dialog_tri_state_triangle_top.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 CypherOS

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.
-->
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/shape_id" android:width="42.0px">
<rotate android:layout_width="fill_parent" android:layout_height="wrap_content" android:fromDegrees="45.0" android:pivotX="0.0%" android:pivotY="100.0%">
<shape android:shape="rectangle">
<solid android:color="#ff000000" />
<size android:height="29.695984px" android:width="29.695984px" />
</shape>
</rotate>
</item>
</layer-list>
29 changes: 29 additions & 0 deletions packages/SystemUI/res/drawable/dialog_tri_state_up_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 CypherOS

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.
-->
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="#ff1d1d1d" />
<corners
android:topLeftRadius="@dimen/tri_state_up_top_left_radius"
android:topRightRadius="@dimen/tri_state_up_top_right_radius"
android:bottomLeftRadius="@dimen/tri_state_up_bottom_left_radius"
android:bottomRightRadius="@dimen/tri_state_up_bottom_right_radius" />
</shape>
</item>
</layer-list>
Loading