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

Create shortcut #627

Closed
Sergei-Alekseev opened this issue Nov 16, 2021 · 6 comments
Closed

Create shortcut #627

Sergei-Alekseev opened this issue Nov 16, 2021 · 6 comments
Labels
Bug Something isn't working Priority: 1 Severity: 3 Status: Accepted Accepted or approved feature/issue
Milestone

Comments

@Sergei-Alekseev
Copy link

Describe the bug
Create shortcut button in activity section make nothing.

To Reproduce
Steps to reproduce the behaviour:

  1. Go to 'activities tab.'
  2. Click on 'create shortcut' on some activity.

Expected behavior
Shortcut is created.

Crash logs
Cant add logs because logd is removed. And no crashes at all.

Device info

  • Device: Fly FS526 Power Plus 2
  • OS Version: Android 7
  • App Manager Version: v2.6.4
  • Mode: root, Magisk.

Additional context
Default launcher is removed. Current default launcher is Holo Launcher.

This was referenced Nov 16, 2021
@MuntashirAkon
Copy link
Owner

AM tries to create shortcuts using all the methods provided by the AOSP. If they don't work, there isn't much I can do about it without logs. Sorry!

@MuntashirAkon MuntashirAkon added the Status: Info Requested Further information is requested label Dec 14, 2021
@MuntashirAkon
Copy link
Owner

Closed due to lack of response. Feel free to open it again if you're still facing the issue.

@chsbuffer
Copy link

chsbuffer commented Sep 15, 2022

CharSequence newShortcutName = mShortcutNameField.getText();

this getText() returns a SpannableString (like String, it also implements CharSequence)

but Pixel Launcher only allows String as shortcut name. (tho I didn't find a docment says it MUST be String)

image
MIUI Launcher also use getStringExtra("android.intent.extra.shortcut.NAME"), but it forgets to null check lol.

com.miui.home crash log
09-15 21:48:10.837 18458 18458 E AndroidRuntime: FATAL EXCEPTION: main
09-15 21:48:10.837 18458 18458 E AndroidRuntime: Process: com.miui.home, PID: 18458
09-15 21:48:10.837 18458 18458 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String java.lang.CharSequence.toString()' on a null object reference
09-15 21:48:10.837 18458 18458 E AndroidRuntime:        at com.miui.home.launcher.ShortcutInfo.makeUniquelyShortcutKey(ShortcutInfo.java:609)
09-15 21:48:10.837 18458 18458 E AndroidRuntime:        at com.miui.home.launcher.LauncherModel.isDupShortcut(LauncherModel.java:2623)
09-15 21:48:10.837 18458 18458 E AndroidRuntime:        at com.miui.home.launcher.InstallShortcutReceiver$1.run(InstallShortcutReceiver.java:214)
09-15 21:48:10.837 18458 18458 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:938)
09-15 21:48:10.837 18458 18458 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
09-15 21:48:10.837 18458 18458 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:210)
09-15 21:48:10.837 18458 18458 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:299)
09-15 21:48:10.837 18458 18458 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:8105)
09-15 21:48:10.837 18458 18458 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
09-15 21:48:10.837 18458 18458 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
09-15 21:48:10.837 18458 18458 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)

I would blame AndroidX for not handling it well.

Workaround (untested)

 CharSequence newShortcutName = mShortcutNameField.getText().toString();

@MuntashirAkon MuntashirAkon reopened this Sep 15, 2022
@MuntashirAkon MuntashirAkon added Priority: 1 Status: Accepted Accepted or approved feature/issue and removed Status: Info Requested Further information is requested Priority: 3 labels Sep 15, 2022
@MuntashirAkon MuntashirAkon added this to the v3.0.2 milestone Sep 15, 2022
@MuntashirAkon
Copy link
Owner

Thanks for finding that out. The fix will be available in the next release.

@MuntashirAkon
Copy link
Owner

I would blame AndroidX for not handling it well.

This indeed looks as if the field is meant for String only. Maybe you should open an issue in the Google issue tracker, too.

@MuntashirAkon
Copy link
Owner

Should be fixed in c47333f. I don't know if it is fixed for certain because I have no way to test this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Priority: 1 Severity: 3 Status: Accepted Accepted or approved feature/issue
Projects
None yet
Development

No branches or pull requests

3 participants