WAI
Status Update
Comments
am...@google.com <am...@google.com>
am...@google.com <am...@google.com> #2
This issue does not reproduce with dev preview 4.
lb...@gmail.com <lb...@gmail.com> #3
Closing this issue as per comment #2 from reporter.
am...@google.com <am...@google.com> #4
Thanks again for the report. As per the design in O, the launcher adds icons when an actual package is installed, if the install reason is INSTALL_REASON_USER. The intention of this behavior is not as a work around to allow 3rd party apps to control the user's work space by adding app icons. 3rd party apps are allowed to add *shortcuts* to the work space with the user's consent using the new APIs in O.
lb...@gmail.com <lb...@gmail.com> #5
@4 This doesn't match what I was told by Google:
"The API for adding a launcher icon already exists. When installing the APK using PackageInstaller API, the caller has to set proper install reason:
https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionParams.html#setInstallReason(int)
The Launcher policy is to add icon on home screen if the reason is INSTALL_REASON_USER.
"
The user already does get a confirmation for installing the app.
Why didn't you just add a confirmation for shortcuts, to trust the app from now on to create shortcuts? Why the need to do it again and again? This makes it extremely annoying in the case of batch creation of shortcuts (user needs to press the same button over and over again) .
Not only that, but there is no backward compatibility of shortcuts creation for other launchers. Currently, the only launcher that can create shortcuts on Android O is Pixel Launcher. Can't find even one third party launcher that can still create shortcuts from other apps, not to mention background creations of them, as was possible before.
This choice of change is really frustrating me, as both a user and a developer. I want to be able to create shortcuts in the background, and it's ok for me as a user to grant that to apps I trust, like my own app.
Recently I've found other apps that of course fail to create shortcuts, because of this change. One of them is actually paid for, that I got:
https://play.google.com/store/apps/details?id=com.bhanu.appshortcutmaker
Because of this, I've decided to create a new post:
https://issuetracker.google.com/issues/65101634
"The API for adding a launcher icon already exists. When installing the APK using PackageInstaller API, the caller has to set proper install reason:
The Launcher policy is to add icon on home screen if the reason is INSTALL_REASON_USER.
"
The user already does get a confirmation for installing the app.
Why didn't you just add a confirmation for shortcuts, to trust the app from now on to create shortcuts? Why the need to do it again and again? This makes it extremely annoying in the case of batch creation of shortcuts (user needs to press the same button over and over again) .
Not only that, but there is no backward compatibility of shortcuts creation for other launchers. Currently, the only launcher that can create shortcuts on Android O is Pixel Launcher. Can't find even one third party launcher that can still create shortcuts from other apps, not to mention background creations of them, as was possible before.
This choice of change is really frustrating me, as both a user and a developer. I want to be able to create shortcuts in the background, and it's ok for me as a user to grant that to apps I trust, like my own app.
Recently I've found other apps that of course fail to create shortcuts, because of this change. One of them is actually paid for, that I got:
Because of this, I've decided to create a new post:
Description
OSR1.170720.005
* What device are you using? (for example, Nexus 6P)
Emulator
* What are the steps to reproduce the problem? (Please provide the minimal reproducible test case.)
Create an app that installs an APK using PackageInstaller, while adding install reason of INSTALL_REASON_USER .
Based on what I was told (here:
The reason I investigate it, is that the whole feature of creating a shortcut in the background was entirely removed, but even now, the alternatives that were given to me for manual form never seem to work properly.
I really hope for much better alternatives to the previous legit API of creating multiple app shortcuts in the background, but still I can't find any, not even in manual form.
When I install an app, I want to have an app icon for it automatically on the launcher, no matter how the app got installed (APK, adb, play store, alternatives...) and in which API. That's why I added this feature on my small app:
My app already has more than 300K downloads, and I'm really frustrated by the new Android O API that removed one of the basic features my app has.
It's really unfair to remove a long working API, and not offer anything as an alternative in return, without even backward compatibility. If you want to have better security/privacy, or avoiding spammy apps, there are much better ways than total removal of API...
That's why I created so many posts about alternatives that Google should consider, and that's why I also tried what Google suggests to use, at least in some cases.
Anyway, here's the code (also attached sample project) :
PackageInstaller pi = getPackageManager().getPackageInstaller();
PackageInstaller.SessionParams params = new PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL);
params.setInstallReason(PackageManager.INSTALL_REASON_USER);
try {
int sessionId = pi.createSession(params);
PackageInstaller.Session session = pi.openSession(sessionId);
byte[] buffer = new byte[4096];
try (InputStream in = getResources().openRawResource(R.raw.sample2)) {
try (OutputStream out = session.openWrite("sample2.apk", 0, -1)) {
while (true) {
int numRead = in.read(buffer);
if (numRead == -1)
break;
out.write(buffer, 0, numRead);
}
out.flush();
}
}
IntentFilter filter = new IntentFilter(ACTION);
registerReceiver(mReceiver, filter);
Intent intent = new Intent(ACTION);
PendingIntent pendingIntent = PendingIntent.getBroadcast(MainActivity.this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
session.commit(pendingIntent.getIntentSender());
} catch (IOException e) {
Log.e("AppLog", "Could not create session", e);
}
* Issue Category e.g. Framework (platform), NDK (platform), Hardware (CPU, GPU, Sensor, Camera), ART (platform), Runtime Permissions etc
Framework
* What was the expected result?
After the APK got installed, see a new shortcut on the launcher.
* What was the actual result?
The app gets installed, but no new shortcut appear.
* Optional: Link to any screenshot(s) that demonstrate the issue (shared privately in Drive.)
Attached.