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

Quickshortcuts for android 6 & 7.0 #233

Closed
AxiK101 opened this issue Jul 17, 2017 · 32 comments
Closed

Quickshortcuts for android 6 & 7.0 #233

AxiK101 opened this issue Jul 17, 2017 · 32 comments

Comments

@AxiK101
Copy link

AxiK101 commented Jul 17, 2017

Is it possible? Please make it happen. Sorry if this feature has been asked before.

Sent from my Sony F3211 using FastHub

@RWOne
Copy link

RWOne commented Jul 17, 2017

Can you elaborate?
You mean app shortcuts?

App shortcuts are functional.

@AxiK101
Copy link
Author

AxiK101 commented Jul 17, 2017

@RWOne Yes on android 7.1.1 or higher. I mean app shortcuts for the no supporting OS like android 6 & 7.

Sent from my Sony F3211 using FastHub

@RWOne
Copy link

RWOne commented Jul 17, 2017

@AxiK101 They're working, if you are not seeing them, set the Lawnchair launcher as the default.
Settings -> Search for home, select home app and select.

@AxiK101
Copy link
Author

AxiK101 commented Jul 17, 2017

No shortcuts

Sent from my Sony F3211 using FastHub

@RWOne
Copy link

RWOne commented Jul 17, 2017

See above, set launcher as the default, then retry.

@AxiK101
Copy link
Author

AxiK101 commented Jul 17, 2017

I am not retard dude. I know what i am doing and saying. I run android 7.0, i have Lawnchair as my default luncher, no shortcuts working. Sony Xperia XA Ultra device.

Sent from my Sony F3211 using FastHub

@RWOne
Copy link

RWOne commented Jul 17, 2017

No one's calling you anything. Lose the attitude at the door, or let it close behind you when you leave.
May be a device specific thing then, stock 7.1.1 working here.

@AxiK101
Copy link
Author

AxiK101 commented Jul 17, 2017

There is no attitude. You said on 7.1.1 is working. I know that. The point is to make it work on 7.0.0. I am realy clear to what i ask. If you don't have a proper solution, plz do not mention the obvious

Sent from my Sony F3211 using FastHub

@RWOne
Copy link

RWOne commented Jul 17, 2017

There may not be one, app shortcuts were introduced in 7.1.X, may not be backportable.

@AxiK101
Copy link
Author

AxiK101 commented Jul 17, 2017

Well maybe you are right. But some launchers like nova, action, evie do support quickshortcuts for older OS. I just hope that devs could make them work for Lawnchair too

Sent from my Sony F3211 using FastHub

@ghost
Copy link

ghost commented Jul 17, 2017

@RWOne

He's right. I had an issue asking about this and the dev said that there are not available on 7.0 or lower. The app shortcuts got introduced on 7.1.1 but some launchers made them work on 7.0/6.0.

Well those launchers use the old UI for App Shortcuts from Pixel Launcher Nougat version. So or the dev didn't look into this or the code for shortcuts also have been changed and for now there's no way to bring this feature on 7.0 or lower.

@AxiK101
Copy link
Author

AxiK101 commented Jul 17, 2017

Wish the devs would try this out

Sent from my Sony F3211 using FastHub

@KieronQuinn
Copy link
Contributor

It is absolutely possible to get the static shortcuts on <Android 7.1. It's nothing to do with UIs at all, and doesn't even need you to copy source from AOSP. You just have to do a process that is quite slow, and a little hacky. As far as I am aware, this is how other launchers do it, and it does work (I used the method in Custom Quick Settings):

For each of the packages on the device:

  • Load the APK's absolute location using ApplicationInfo.publicSourceDir (you MUST use the GET_META_DATA and GET_SHARED_LIBRARY_FILES flags when using getInstalledApplications)
  • Use this location along with ZipFile to load the APK as a zip (you can do this, strangely)
  • Load the manifest file using ZipFile.getEntry("AndroidManifest.xml"), and get the byte representation from the file as you would any other
  • Decompress the XML. This is a bit difficult, I based my code off this: https://stackoverflow.com/a/4761689/1088334
  • Parse the XML as you would any other, searching for a meta-data tag with the android:name of "android.app.shortcuts". In the case of Lawnchair, you would need to store the activity component too obviously, but that wasn't required for CQS
  • The android:resource attribute is what you want here, it will be in the form of a resource ID (use Integer.parseInt(..., 16)). That's the hard bit done.
  • Use PackageManager.getResourcesForApplication to get the resources for the package, and use PackageManager.getXml to get the XML file for reading. The XML is in a standard format, like this: https://developer.android.com/samples/AppShortcuts/res/xml/shortcuts.html. Parse that, and use your resources for application to load the icons and labels.

That's it! I do recommend storing this data in the case of a launcher though, as it's quite a slow process to do every relaunch, but please only do so on <7.1, it's not a great idea to store shortcuts on >=7.1 because they change often with dynamic shortcuts

@AxiK101
Copy link
Author

AxiK101 commented Jul 17, 2017

@KieronQuinn You should apply in the developing group dude. Nice!

Sent from my Sony F3211 using FastHub

@KieronQuinn
Copy link
Contributor

@AxiK101 I'm busy with my own projects right now so am not taking on any others but will consider it in the future

@AxiK101
Copy link
Author

AxiK101 commented Jul 17, 2017

Good to know. 😉

Sent from my Sony F3211 using FastHub

@ghost
Copy link

ghost commented Jul 18, 2017

@deletescape Could you try what KieronQuinn said above?

@Dondrejohnson5
Copy link

Hey, no one mentioned Android 5.0. What's up with that?

@suphon-t
Copy link
Member

suphon-t commented Jul 21, 2017

@KieronQuinn After some searching, I found a hidden method that allows AssetManager to load the manifest file. So the first four hard steps is not required anymore.

@suphon-t suphon-t reopened this Jul 21, 2017
@AxiK101
Copy link
Author

AxiK101 commented Jul 21, 2017

Hey @paphonbth, on latest beta it says that app shortcuts backported but are inactive. Does this meen you found a way to make them work for <7.1 devices?

@suphon-t
Copy link
Member

Yes but currently disabled because it isn't optimized yet.

@Steve-Mr
Copy link

Hoping this feature can run on lolipop...

@Dondrejohnson5
Copy link

Bro, same here Mr Steve

@KieronQuinn
Copy link
Contributor

I can't see why it wouldn't (assuming Lawnchair does, I've never checked), it works fine on 5.x for Custom Quick Settings

@AxiK101
Copy link
Author

AxiK101 commented Jul 27, 2017

Sesame shortcuts app gave Nova launcher a boost. Now almost all shortcuts work, even the ones that was only for 7.1.+

Sent from my Sony F3211 using FastHub

@fonix232
Copy link
Member

Sesame uses an app-specific approach with "hard coded" methods. Basically on API25 apps, they can define custom methods to dynamically generate the shortcuts (the part we can't do on API<25), and can also define static links (which we can, and do display). What Sesame does is basically extracting the former methods and moving it to a common library, so that the apps don't have to define it. It is practically a huge database of functions that define shortcuts for certain apps, nothing more. We can't do that.

@KieronQuinn
Copy link
Contributor

Sesame appears to mostly make use of deeplink URIs, if you install it and check the config file it produces (needs root), you can see what it's linking to.

A good example of this is FB Messenger, where you can simply do:
am start -d fb-messenger://groupthreadfbid/<id>
where ID is the numeric ID of a group thread (check messenger.com's URLs) and it will open the thread

Messenger has loads of these, as does Facebook, Instagram, and loads of other apps. Hell, you can even use normal URLs in some cases, like for Discord:
am start -d https://discordapp.com/channels/<id>

The reason I'm so for app shortcuts is I'm actually in the process of making Custom App Shortcuts, which edits the system shortcuts.xml file (API 25+) and has similar results to Sesame, but has more possibilities for launch (for example Sesame can't open links to group chats in some messenger clients, CAS can, as it has more privileges), as well as supporting any launcher that supports app shortcuts (except Action launcher, because that uses a strange caching method - hence why I was against caching for Lawnchair on API 25+)

@AxiK101
Copy link
Author

AxiK101 commented Aug 1, 2017

@KieronQuinn is there a usable app in development to test? What you suggest is awesome

Sent from my Sony F3211 using FastHub

@jackmort37
Copy link

Hi,
I just installed latest release (v1.0.1063), and using LineageOS 14.1 build of 08/08/2017 for Nexus 5 (so Android 7.1.2), and app shortcuts are not working : I only get edit, widget and app information instead of application shortcuts.
Lawnchair is set as default launcher and all permissions have been granted (Location, Storage and Phone).
How could I get you some debug logs/information to help investigate ?
Thanks.

@nyancrimew
Copy link
Contributor

@jackmort37 please open a new issue for your problem, this is not related

@AxiK101
Copy link
Author

AxiK101 commented Sep 12, 2017

How come some shortcuts to appear in the bubble but when taping no action happens, just they open the app..? Fr example Hangout's doesn't work

@nyancrimew
Copy link
Contributor

@AxiK101 this is probably an issue with the app, Shortcuts aren't made to work on older APIs so we can't grant you that all of them will work.

@LawnchairLauncher LawnchairLauncher deleted a comment from Taddy34 Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants