diff options
Diffstat (limited to 'packages')
7 files changed, 143 insertions, 103 deletions
diff --git a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java index 73a723d..4143e15 100644 --- a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java +++ b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java @@ -120,13 +120,20 @@ public class ExternalStorageProvider extends DocumentsProvider { if (!volume.isMountedReadable()) continue; final String rootId; - if (VolumeInfo.ID_EMULATED_INTERNAL.equals(volume.getId())) { + final String title; + if (volume.getType() == VolumeInfo.TYPE_EMULATED) { + // We currently only support a single emulated volume mounted at + // a time, and it's always considered the primary rootId = ROOT_ID_PRIMARY_EMULATED; - } else if (volume.getType() == VolumeInfo.TYPE_EMULATED) { - final VolumeInfo privateVol = mStorageManager.findPrivateForEmulated(volume); - rootId = privateVol.getFsUuid(); + if (VolumeInfo.ID_EMULATED_INTERNAL.equals(volume.getId())) { + title = getContext().getString(R.string.root_internal_storage); + } else { + final VolumeInfo privateVol = mStorageManager.findPrivateForEmulated(volume); + title = mStorageManager.getBestVolumeDescription(privateVol); + } } else if (volume.getType() == VolumeInfo.TYPE_PUBLIC) { rootId = volume.getFsUuid(); + title = mStorageManager.getBestVolumeDescription(volume); } else { // Unsupported volume; ignore continue; @@ -148,11 +155,7 @@ public class ExternalStorageProvider extends DocumentsProvider { root.rootId = rootId; root.flags = Root.FLAG_SUPPORTS_CREATE | Root.FLAG_LOCAL_ONLY | Root.FLAG_ADVANCED | Root.FLAG_SUPPORTS_SEARCH | Root.FLAG_SUPPORTS_IS_CHILD; - if (ROOT_ID_PRIMARY_EMULATED.equals(rootId)) { - root.title = getContext().getString(R.string.root_internal_storage); - } else { - root.title = mStorageManager.getBestVolumeDescription(volume); - } + root.title = title; if (volume.getType() == VolumeInfo.TYPE_PUBLIC) { root.flags |= Root.FLAG_HAS_SETTINGS; } diff --git a/packages/Shell/src/com/android/shell/BugreportReceiver.java b/packages/Shell/src/com/android/shell/BugreportReceiver.java index e1bfc43..13747ed 100644 --- a/packages/Shell/src/com/android/shell/BugreportReceiver.java +++ b/packages/Shell/src/com/android/shell/BugreportReceiver.java @@ -33,11 +33,23 @@ import android.os.FileUtils; import android.os.SystemProperties; import android.support.v4.content.FileProvider; import android.text.format.DateUtils; +import android.util.Log; import android.util.Patterns; import com.google.android.collect.Lists; +import libcore.io.Streams; +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.Closeable; import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; import java.util.ArrayList; /** @@ -73,30 +85,14 @@ public class BugreportReceiver extends BroadcastReceiver { final Uri bugreportUri = FileProvider.getUriForFile(context, AUTHORITY, bugreportFile); final Uri screenshotUri = FileProvider.getUriForFile(context, AUTHORITY, screenshotFile); - Intent sendIntent = buildSendIntent(context, bugreportUri, screenshotUri); - Intent notifIntent; - - // Send through warning dialog by default - if (getWarningState(context, STATE_SHOW) == STATE_SHOW) { - notifIntent = buildWarningIntent(context, sendIntent); + boolean isPlainText = bugreportFile.getName().toLowerCase().endsWith(".txt"); + if (!isPlainText) { + // Already zipped, send it right away. + sendBugreportNotification(context, bugreportFile, screenshotFile); } else { - notifIntent = sendIntent; + // Asynchronously zip the file first, then send it. + sendZippedBugreportNotification(context, bugreportFile, screenshotFile); } - notifIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - - final Notification.Builder builder = new Notification.Builder(context) - .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb) - .setContentTitle(context.getString(R.string.bugreport_finished_title)) - .setTicker(context.getString(R.string.bugreport_finished_title)) - .setContentText(context.getString(R.string.bugreport_finished_text)) - .setContentIntent(PendingIntent.getActivity( - context, 0, notifIntent, PendingIntent.FLAG_CANCEL_CURRENT)) - .setAutoCancel(true) - .setLocalOnly(true) - .setColor(context.getColor( - com.android.internal.R.color.system_notification_accent_color)); - - NotificationManager.from(context).notify(TAG, 0, builder.build()); // Clean up older bugreports in background final PendingResult result = goAsync(); @@ -141,6 +137,88 @@ public class BugreportReceiver extends BroadcastReceiver { } /** + * Sends a bugreport notitication. + */ + private static void sendBugreportNotification(Context context, File bugreportFile, + File screenshotFile) { + // Files are kept on private storage, so turn into Uris that we can + // grant temporary permissions for. + final Uri bugreportUri = FileProvider.getUriForFile(context, AUTHORITY, bugreportFile); + final Uri screenshotUri = FileProvider.getUriForFile(context, AUTHORITY, screenshotFile); + + Intent sendIntent = buildSendIntent(context, bugreportUri, screenshotUri); + Intent notifIntent; + + // Send through warning dialog by default + if (getWarningState(context, STATE_SHOW) == STATE_SHOW) { + notifIntent = buildWarningIntent(context, sendIntent); + } else { + notifIntent = sendIntent; + } + notifIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + + final Notification.Builder builder = new Notification.Builder(context) + .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb) + .setContentTitle(context.getString(R.string.bugreport_finished_title)) + .setTicker(context.getString(R.string.bugreport_finished_title)) + .setContentText(context.getString(R.string.bugreport_finished_text)) + .setContentIntent(PendingIntent.getActivity( + context, 0, notifIntent, PendingIntent.FLAG_CANCEL_CURRENT)) + .setAutoCancel(true) + .setLocalOnly(true) + .setColor(context.getColor( + com.android.internal.R.color.system_notification_accent_color)); + + NotificationManager.from(context).notify(TAG, 0, builder.build()); + } + + /** + * Sends a zipped bugreport notification. + */ + private static void sendZippedBugreportNotification(final Context context, + final File bugreportFile, final File screenshotFile) { + new AsyncTask<Void, Void, Void>() { + @Override + protected Void doInBackground(Void... params) { + File zippedFile = zipBugreport(bugreportFile); + sendBugreportNotification(context, zippedFile, screenshotFile); + return null; + } + }.execute(); + } + + /** + * Zips a bugreport file, returning the path to the new file (or to the + * original in case of failure). + */ + private static File zipBugreport(File bugreportFile) { + String bugreportPath = bugreportFile.getAbsolutePath(); + String zippedPath = bugreportPath.replace(".txt", ".zip"); + Log.v(TAG, "zipping " + bugreportPath + " as " + zippedPath); + File bugreportZippedFile = new File(zippedPath); + try (InputStream is = new FileInputStream(bugreportFile); + ZipOutputStream zos = new ZipOutputStream( + new BufferedOutputStream(new FileOutputStream(bugreportZippedFile)))) { + ZipEntry entry = new ZipEntry("bugreport.txt"); + zos.putNextEntry(entry); + int totalBytes = Streams.copy(is, zos); + Log.v(TAG, "size of original bugreport: " + totalBytes + " bytes"); + zos.closeEntry(); + // Delete old file; + boolean deleted = bugreportFile.delete(); + if (deleted) { + Log.v(TAG, "deleted original bugreport (" + bugreportPath + ")"); + } else { + Log.e(TAG, "could not delete original bugreport (" + bugreportPath + ")"); + } + return bugreportZippedFile; + } catch (IOException e) { + Log.e(TAG, "exception zipping file " + zippedPath, e); + return bugreportFile; // Return original. + } + } + + /** * Find the best matching {@link Account} based on build properties. */ private static Account findSendToAccount(Context context) { diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java index 1e7ee98..445ecb6 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java @@ -16,7 +16,6 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.os.RemoteException; -import android.os.ServiceManager; import android.os.UserHandle; import android.provider.Settings; import android.util.Log; @@ -28,12 +27,15 @@ import android.view.ViewGroup; import android.view.WindowManager; import android.widget.ImageView; -import com.android.internal.app.IVoiceInteractionManagerService; +import com.android.internal.app.AssistUtils; import com.android.internal.app.IVoiceInteractionSessionShowCallback; import com.android.systemui.R; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.phone.PhoneStatusBar; +import java.io.FileDescriptor; +import java.io.PrintWriter; + /** * Class to manage everything related to assist in SystemUI. */ @@ -55,7 +57,7 @@ public class AssistManager { private final WindowManager mWindowManager; private AssistOrbContainer mView; private final PhoneStatusBar mBar; - private final IVoiceInteractionManagerService mVoiceInteractionManagerService; + private final AssistUtils mAssistUtils; private ComponentName mAssistComponent; @@ -92,8 +94,7 @@ public class AssistManager { mContext = context; mBar = bar; mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); - mVoiceInteractionManagerService = IVoiceInteractionManagerService.Stub.asInterface( - ServiceManager.getService(Context.VOICE_INTERACTION_MANAGER_SERVICE)); + mAssistUtils = new AssistUtils(context); mContext.getContentResolver().registerContentObserver( Settings.Secure.getUriFor(Settings.Secure.ASSISTANT), false, @@ -140,11 +141,7 @@ public class AssistManager { } public void hideAssist() { - try { - mVoiceInteractionManagerService.hideCurrentSession(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call hideCurrentSession", e); - } + mAssistUtils.hideCurrentSession(); } private WindowManager.LayoutParams getLayoutParams() { @@ -216,58 +213,27 @@ public class AssistManager { } private void startVoiceInteractor() { - try { - mVoiceInteractionManagerService.showSessionForActiveService(mShowCallback); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call showSessionForActiveService", e); - } + mAssistUtils.showSessionForActiveService(mShowCallback); } public void launchVoiceAssistFromKeyguard() { - try { - mVoiceInteractionManagerService.launchVoiceAssistFromKeyguard(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call launchVoiceAssistFromKeyguard", e); - } + mAssistUtils.launchVoiceAssistFromKeyguard(); } private boolean getVoiceInteractorSupportsAssistGesture() { - try { - return mVoiceInteractionManagerService != null - && mVoiceInteractionManagerService.activeServiceSupportsAssist(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call activeServiceSupportsAssistGesture", e); - return false; - } + return mAssistUtils.activeServiceSupportsAssistGesture(); } public boolean canVoiceAssistBeLaunchedFromKeyguard() { - try { - return mVoiceInteractionManagerService != null - && mVoiceInteractionManagerService.activeServiceSupportsLaunchFromKeyguard(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call activeServiceSupportsLaunchFromKeyguard", e); - return false; - } + return mAssistUtils.activeServiceSupportsLaunchFromKeyguard(); } public ComponentName getVoiceInteractorComponentName() { - try { - return mVoiceInteractionManagerService.getActiveServiceComponentName(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call getActiveServiceComponentName", e); - return null; - } + return mAssistUtils.getActiveServiceComponentName(); } private boolean isVoiceSessionRunning() { - try { - return mVoiceInteractionManagerService != null - && mVoiceInteractionManagerService.isSessionRunning(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call isSessionRunning", e); - return false; - } + return mAssistUtils.isSessionRunning(); } public void destroy() { @@ -324,26 +290,11 @@ public class AssistManager { } private void updateAssistInfo() { - final String setting = Settings.Secure.getStringForUser(mContext.getContentResolver(), - Settings.Secure.ASSISTANT, UserHandle.USER_CURRENT); - if (setting != null) { - mAssistComponent = ComponentName.unflattenFromString(setting); - return; - } - - // Fallback to keep backward compatible behavior when there is no user setting. - if (getVoiceInteractorSupportsAssistGesture()) { - mAssistComponent = getVoiceInteractorComponentName(); - return; - } - - Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) - .getAssistIntent(mContext, false, UserHandle.USER_CURRENT); - if (intent != null) { - mAssistComponent = intent.getComponent(); - return; - } + mAssistComponent = mAssistUtils.getAssistComponentForUser(UserHandle.USER_CURRENT); + } - mAssistComponent = null; + public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + pw.println("AssistManager state:"); + pw.print(" mAssistComponent="); pw.println(mAssistComponent); } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index f00fed5..c06b34f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -371,7 +371,6 @@ public class KeyguardViewMediator extends SystemUI { @Override public void onDeviceProvisioned() { sendUserPresentBroadcast(); - updateInputRestricted(); } @Override @@ -947,7 +946,7 @@ public class KeyguardViewMediator extends SystemUI { * was suppressed by an app that disabled the keyguard or we haven't been provisioned yet. */ public boolean isInputRestricted() { - return mShowing || mNeedToReshowWhenReenabled || shouldWaitForProvisioning(); + return mShowing || mNeedToReshowWhenReenabled; } private void updateInputRestricted() { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index c8212c2..9761cd1 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -242,6 +242,9 @@ public class QSPanel extends ViewGroup { } private void handleSetTileVisibility(View v, int visibility) { + if (visibility == VISIBLE && !mGridContentVisible) { + visibility = INVISIBLE; + } if (visibility == v.getVisibility()) return; v.setVisibility(visibility); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index a750572..5ac436a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -1180,7 +1180,9 @@ public class NotificationPanelView extends PanelView implements } else if (statusBarState == StatusBarState.KEYGUARD || statusBarState == StatusBarState.SHADE_LOCKED) { mKeyguardBottomArea.animate().cancel(); - mKeyguardBottomArea.setVisibility(View.VISIBLE); + if (!mDozing) { + mKeyguardBottomArea.setVisibility(View.VISIBLE); + } mKeyguardBottomArea.setAlpha(1f); } else { mKeyguardBottomArea.animate().cancel(); @@ -1263,7 +1265,7 @@ public class NotificationPanelView extends PanelView implements setQsExpanded(true); } else if (height <= mQsMinExpansionHeight && mQsExpanded) { setQsExpanded(false); - if (mLastAnnouncementWasQuickSettings && !mTracking) { + if (mLastAnnouncementWasQuickSettings && !mTracking && !isCollapsing()) { announceForAccessibility(getKeyguardOrLockScreenString()); mLastAnnouncementWasQuickSettings = false; } @@ -1717,7 +1719,8 @@ public class NotificationPanelView extends PanelView implements float alphaQsExpansion = 1 - Math.min(1, getQsExpansionFraction() * 2); mKeyguardStatusBar.setAlpha(Math.min(getKeyguardContentsAlpha(), alphaQsExpansion) * mKeyguardStatusBarAnimateAlpha); - mKeyguardStatusBar.setVisibility(mKeyguardStatusBar.getAlpha() != 0f ? VISIBLE : INVISIBLE); + mKeyguardStatusBar.setVisibility(mKeyguardStatusBar.getAlpha() != 0f + && !mDozing ? VISIBLE : INVISIBLE); setQsTranslation(mQsExpansionHeight); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index c77e7f0..69198ed 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -2687,6 +2687,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, if (mNextAlarmController != null) { mNextAlarmController.dump(fd, pw, args); } + if (mAssistManager != null) { + mAssistManager.dump(fd, pw, args); + } if (mSecurityController != null) { mSecurityController.dump(fd, pw, args); } |