Skip to content

Commit e95c0fd

Browse files
author
android-build-team Robot
committed
Snap for 7262953 from 1de7290 to rvc-qpr3-release
Change-Id: I583350e00ace8e0f841321c386aed6b16885b1dd
2 parents fd13118 + 1de7290 commit e95c0fd

11 files changed

Lines changed: 232 additions & 79 deletions

File tree

core/java/android/app/ActivityManagerInternal.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,21 @@ public abstract void setDebugFlagsForStartingActivity(ActivityInfo aInfo, int st
377377
*/
378378
public abstract boolean hasRunningForegroundService(int uid, int foregroundServiceType);
379379

380+
/**
381+
* Returns {@code true} if the given notification channel currently has a
382+
* notification associated with a foreground service. This is an AMS check
383+
* because that is the source of truth for the FGS state.
384+
*/
385+
public abstract boolean hasForegroundServiceNotification(String pkg, @UserIdInt int userId,
386+
String channelId);
387+
388+
/**
389+
* If the given app has any FGSs whose notifications are in the given channel,
390+
* stop them.
391+
*/
392+
public abstract void stopForegroundServicesForChannel(String pkg, @UserIdInt int userId,
393+
String channelId);
394+
380395
/**
381396
* Registers the specified {@code processObserver} to be notified of future changes to
382397
* process state.

packages/PackageInstaller/src/com/android/packageinstaller/InstallSuccess.java

Lines changed: 61 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@
4141
public class InstallSuccess extends AlertActivity {
4242
private static final String LOG_TAG = InstallSuccess.class.getSimpleName();
4343

44+
@Nullable
45+
private PackageUtil.AppSnippet mAppSnippet;
46+
47+
@Nullable
48+
private String mAppPackageName;
49+
50+
@Nullable
51+
private Intent mLaunchIntent;
52+
4453
@Override
4554
protected void onCreate(@Nullable Bundle savedInstanceState) {
4655
super.onCreate(savedInstanceState);
@@ -55,59 +64,73 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
5564
Intent intent = getIntent();
5665
ApplicationInfo appInfo =
5766
intent.getParcelableExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO);
67+
mAppPackageName = appInfo.packageName;
5868
Uri packageURI = intent.getData();
5969

6070
// Set header icon and title
61-
PackageUtil.AppSnippet as;
6271
PackageManager pm = getPackageManager();
6372

6473
if ("package".equals(packageURI.getScheme())) {
65-
as = new PackageUtil.AppSnippet(pm.getApplicationLabel(appInfo),
74+
mAppSnippet = new PackageUtil.AppSnippet(pm.getApplicationLabel(appInfo),
6675
pm.getApplicationIcon(appInfo));
6776
} else {
6877
File sourceFile = new File(packageURI.getPath());
69-
as = PackageUtil.getAppSnippet(this, appInfo, sourceFile);
78+
mAppSnippet = PackageUtil.getAppSnippet(this, appInfo, sourceFile);
7079
}
7180

72-
mAlert.setIcon(as.icon);
73-
mAlert.setTitle(as.label);
74-
mAlert.setView(R.layout.install_content_view);
75-
mAlert.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.launch), null,
76-
null);
77-
mAlert.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.done),
78-
(ignored, ignored2) -> {
79-
if (appInfo.packageName != null) {
80-
Log.i(LOG_TAG, "Finished installing " + appInfo.packageName);
81-
}
82-
finish();
83-
}, null);
84-
setupAlert();
85-
requireViewById(R.id.install_success).setVisibility(View.VISIBLE);
86-
// Enable or disable "launch" button
87-
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(
88-
appInfo.packageName);
89-
boolean enabled = false;
90-
if (launchIntent != null) {
91-
List<ResolveInfo> list = getPackageManager().queryIntentActivities(launchIntent,
92-
0);
93-
if (list != null && list.size() > 0) {
94-
enabled = true;
95-
}
96-
}
81+
mLaunchIntent = getPackageManager().getLaunchIntentForPackage(mAppPackageName);
82+
83+
bindUi();
84+
}
85+
}
86+
87+
@Override
88+
protected void onResume() {
89+
super.onResume();
90+
bindUi();
91+
}
9792

98-
Button launchButton = mAlert.getButton(DialogInterface.BUTTON_POSITIVE);
99-
if (enabled) {
100-
launchButton.setOnClickListener(view -> {
101-
try {
102-
startActivity(launchIntent);
103-
} catch (ActivityNotFoundException | SecurityException e) {
104-
Log.e(LOG_TAG, "Could not start activity", e);
93+
private void bindUi() {
94+
if (mAppSnippet == null) {
95+
return;
96+
}
97+
98+
mAlert.setIcon(mAppSnippet.icon);
99+
mAlert.setTitle(mAppSnippet.label);
100+
mAlert.setView(R.layout.install_content_view);
101+
mAlert.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.launch), null,
102+
null);
103+
mAlert.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.done),
104+
(ignored, ignored2) -> {
105+
if (mAppPackageName != null) {
106+
Log.i(LOG_TAG, "Finished installing " + mAppPackageName);
105107
}
106108
finish();
107-
});
108-
} else {
109-
launchButton.setEnabled(false);
109+
}, null);
110+
setupAlert();
111+
requireViewById(R.id.install_success).setVisibility(View.VISIBLE);
112+
// Enable or disable "launch" button
113+
boolean enabled = false;
114+
if (mLaunchIntent != null) {
115+
List<ResolveInfo> list = getPackageManager().queryIntentActivities(mLaunchIntent,
116+
0);
117+
if (list != null && list.size() > 0) {
118+
enabled = true;
110119
}
111120
}
121+
122+
Button launchButton = mAlert.getButton(DialogInterface.BUTTON_POSITIVE);
123+
if (enabled) {
124+
launchButton.setOnClickListener(view -> {
125+
try {
126+
startActivity(mLaunchIntent);
127+
} catch (ActivityNotFoundException | SecurityException e) {
128+
Log.e(LOG_TAG, "Could not start activity", e);
129+
}
130+
finish();
131+
});
132+
} else {
133+
launchButton.setEnabled(false);
134+
}
112135
}
113136
}

packages/SettingsLib/RestrictedLockUtils/res/values-nl/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717

1818
<resources xmlns:android="http://schemas.android.com/apk/res/android"
1919
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
20-
<string name="enabled_by_admin" msgid="6630472777476410137">"Ingeschakeld door beheerder"</string>
21-
<string name="disabled_by_admin" msgid="4023569940620832713">"Uitgeschakeld door beheerder"</string>
20+
<string name="enabled_by_admin" msgid="6630472777476410137">"Aangezet door beheerder"</string>
21+
<string name="disabled_by_admin" msgid="4023569940620832713">"Uitgezet door beheerder"</string>
2222
</resources>

packages/SettingsLib/res/values-bs/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@
369369
<string name="immediately_destroy_activities_summary" msgid="6289590341144557614">"Obustavlja se svaka aktivnost čim je korisnik napusti"</string>
370370
<string name="app_process_limit_title" msgid="8361367869453043007">"Ograničenje procesa u pozadini"</string>
371371
<string name="show_all_anrs" msgid="9160563836616468726">"Prikaži ANR-e u pozadini"</string>
372-
<string name="show_all_anrs_summary" msgid="8562788834431971392">"Prikaz dijaloga \"Aplikacija ne reagira\" za aplikacije pokrenute u pozadini"</string>
372+
<string name="show_all_anrs_summary" msgid="8562788834431971392">"Prikaz dijaloškog okvira \"Aplikacija ne reagira\" za aplikacije pokrenute u pozadini"</string>
373373
<string name="show_notification_channel_warnings" msgid="3448282400127597331">"Prikaži upozorenja kanala obavještenja"</string>
374374
<string name="show_notification_channel_warnings_summary" msgid="68031143745094339">"Prikaz upozorenja na ekranu kada aplikacija pošalje obavještenje bez važećeg kanala"</string>
375375
<string name="force_allow_on_external" msgid="9187902444231637880">"Nametni aplikacije na vanjskoj pohrani"</string>

packages/SettingsLib/res/values-nl/arrays.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
<item msgid="6421717003037072581">"HDCP-controle altijd gebruiken"</item>
6060
</string-array>
6161
<string-array name="bt_hci_snoop_log_entries">
62-
<item msgid="695678520785580527">"Uitgeschakeld"</item>
63-
<item msgid="6336372935919715515">"Gefilterd ingeschakeld"</item>
64-
<item msgid="2779123106632690576">"Ingeschakeld"</item>
62+
<item msgid="695678520785580527">"Uitgezet"</item>
63+
<item msgid="6336372935919715515">"Gefilterd staat aan"</item>
64+
<item msgid="2779123106632690576">"Aangezet"</item>
6565
</string-array>
6666
<string-array name="bluetooth_avrcp_versions">
6767
<item msgid="6603880723315236832">"AVRCP 1.5 (standaard)"</item>

0 commit comments

Comments
 (0)