Obsolete
Status Update
Comments
a....@gmail.com <a....@gmail.com> #2
[Comment deleted]
vi...@gmail.com <vi...@gmail.com> #3
Oh, and I'm seeing this on both the emulator and a Galaxy Nexus. Simply launching an activity that does something like this is enough to reproduce:
ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
manager.addPrimaryClipChangedListener(new ClipboardManager.OnPrimaryClipChangedListener() {
@Override
public void onPrimaryClipChanged() { }
});
ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
manager.addPrimaryClipChangedListener(new ClipboardManager.OnPrimaryClipChangedListener() {
@Override
public void onPrimaryClipChanged() { }
});
to...@gmail.com <to...@gmail.com> #4
Could you please give full steps to reproduce, including the app to run that is causing it? The crash here shows it failing when setting the clipboard, which generally works; I need to to be able to see more specifically what this particular app is doing.
Also the API demo "Clipboard/Data Types" does use addPrimaryClipChangedListener() and doesn't have this problem, and the stack crawl originally shown doesn't have anything about addPrimaryClipChangedListener() in it, so there is some information I am missing.
Thanks!
Also the API demo "Clipboard/Data Types" does use addPrimaryClipChangedListener() and doesn't have this problem, and the stack crawl originally shown doesn't have anything about addPrimaryClipChangedListener() in it, so there is some information I am missing.
Thanks!
se...@gmail.com <se...@gmail.com> #5
What application are you trying to copy text from after adding a listener? I'm copying text from other apps like Messaging or Search and not the application the listener itself is from.
I have no idea if I'm on the right track, but my personal hypothesis is that this is caused because AppOpsService's uid verification is trying to verify the uid for the *listener's* application but the calling uid (Binder.getCallingUid()) is that of the application the text is being copied from. This leads to the permission check for UPDATE_APP_OPS_STATS which will obviously fail.
The code snippet I posted is basically the full "application" you should be able to reproduce this with. So this should be it:
1. Create a new Android app in $IDE_OF_CHOICE
2. Add a new OnPrimaryClipChangedListener in the onCreate of that application's activity -- it's contents don't matter
3. Install and launch the activity
4. Copy text from any other application
5. Crash.
I have no idea if I'm on the right track, but my personal hypothesis is that this is caused because AppOpsService's uid verification is trying to verify the uid for the *listener's* application but the calling uid (Binder.getCallingUid()) is that of the application the text is being copied from. This leads to the permission check for UPDATE_APP_OPS_STATS which will obviously fail.
The code snippet I posted is basically the full "application" you should be able to reproduce this with. So this should be it:
1. Create a new Android app in $IDE_OF_CHOICE
2. Add a new OnPrimaryClipChangedListener in the onCreate of that application's activity -- it's contents don't matter
3. Install and launch the activity
4. Copy text from any other application
5. Crash.
a....@gmail.com <a....@gmail.com> #6
I'm experiencing similar bug. for example, go to message app, tap and hold a message and copy text. the app will crash (the copy will save in clipboard though)
ad...@manichord.com <ad...@manichord.com> #7
I have the same problem, I have an app that starts observing clipboard and since I updated to 4.3 that app crashes with similar exception to this from the first post (android.permission.UPDATE_APP_OPS_STATS)
then every other app that tries to copy something crashes with this exception:
W/dalvikvm(5446): threadid=1: thread exiting with uncaught exception (group=0x419c0700)
W/clipboard(431): Exception:
W/clipboard(431): java.lang.IllegalStateException: beginBroadcast() called while already in a broadcast
W/clipboard(431): at android.os.RemoteCallbackList.beginBroadcast(RemoteCallbackList.java:229)
W/clipboard(431): at com.android.server.ClipboardService.setPrimaryClip(ClipboardService.java:165)
W/clipboard(431): at android.content.IClipboard$Stub.onTransact(IClipboard.java:62)
W/clipboard(431): at com.android.server.ClipboardService.onTransact(ClipboardService.java:123)
W/clipboard(431): at android.os.Binder.execTransact(Binder.java:388)
W/clipboard(431): at dalvik.system.NativeStart.run(Native Method)
E/AndroidRuntime(5446): FATAL EXCEPTION: main
E/AndroidRuntime(5446): java.lang.IllegalStateException: beginBroadcast() called while already in a broadcast
E/AndroidRuntime(5446): at android.os.Parcel.readException(Parcel.java:1439)
E/AndroidRuntime(5446): at android.os.Parcel.readException(Parcel.java:1385)
E/AndroidRuntime(5446): at android.content.IClipboard$Stub$Proxy.setPrimaryClip(IClipboard.java:171)
E/AndroidRuntime(5446): at android.content.ClipboardManager.setPrimaryClip(ClipboardManager.java:125)
E/AndroidRuntime(5446): at android.content.ClipboardManager.setText(ClipboardManager.java:208)
E/AndroidRuntime(5446): at com.google.android.apps.authenticator.AuthenticatorActivity.onContextItemSelected(AuthenticatorActivity.java:927)
E/AndroidRuntime(5446): at com.google.android.apps.authenticator.AuthenticatorActivity.access$200(AuthenticatorActivity.java:73)
E/AndroidRuntime(5446): at com.google.android.apps.authenticator.AuthenticatorActivity$3.onActionItemClicked(AuthenticatorActivity.java:353)
E/AndroidRuntime(5446): at android.widget.AbsListView$MultiChoiceModeWrapper.onActionItemClicked(AbsListView.java:6058)
E/AndroidRuntime(5446): at com.android.internal.policy.impl.PhoneWindow$DecorView$ActionModeCallbackWrapper.onActionItemClicked(PhoneWindow.java:2569)
E/AndroidRuntime(5446): at com.android.internal.app.ActionBarImpl$ActionModeImpl.onMenuItemSelected(ActionBarImpl.java:962)
E/AndroidRuntime(5446): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
E/AndroidRuntime(5446): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
E/AndroidRuntime(5446): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
E/AndroidRuntime(5446): at com.android.internal.view.menu.ActionMenuView.invokeItem(ActionMenuView.java:547)
E/AndroidRuntime(5446): at com.android.internal.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:115)
E/AndroidRuntime(5446): at android.view.View.performClick(View.java:4240)
E/AndroidRuntime(5446): at android.view.View$PerformClick.run(View.java:17721)
E/AndroidRuntime(5446): at android.os.Handler.handleCallback(Handler.java:730)
E/AndroidRuntime(5446): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(5446): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(5446): at android.app.ActivityThread.main(ActivityThread.java:5103)
E/AndroidRuntime(5446): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(5446): at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime(5446): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
E/AndroidRuntime(5446): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime(5446): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(431): Force finishing activity com.google.android.apps.authenticator2/com.google.android.apps.authenticator.AuthenticatorActivity
or similar. Once I disabled clipboard monitoring app and rebooted Nexus 7 the copying worked for sometime.
then every other app that tries to copy something crashes with this exception:
W/dalvikvm(5446): threadid=1: thread exiting with uncaught exception (group=0x419c0700)
W/clipboard(431): Exception:
W/clipboard(431): java.lang.IllegalStateException: beginBroadcast() called while already in a broadcast
W/clipboard(431): at android.os.RemoteCallbackList.beginBroadcast(RemoteCallbackList.java:229)
W/clipboard(431): at com.android.server.ClipboardService.setPrimaryClip(ClipboardService.java:165)
W/clipboard(431): at android.content.IClipboard$Stub.onTransact(IClipboard.java:62)
W/clipboard(431): at com.android.server.ClipboardService.onTransact(ClipboardService.java:123)
W/clipboard(431): at android.os.Binder.execTransact(Binder.java:388)
W/clipboard(431): at dalvik.system.NativeStart.run(Native Method)
E/AndroidRuntime(5446): FATAL EXCEPTION: main
E/AndroidRuntime(5446): java.lang.IllegalStateException: beginBroadcast() called while already in a broadcast
E/AndroidRuntime(5446): at android.os.Parcel.readException(Parcel.java:1439)
E/AndroidRuntime(5446): at android.os.Parcel.readException(Parcel.java:1385)
E/AndroidRuntime(5446): at android.content.IClipboard$Stub$Proxy.setPrimaryClip(IClipboard.java:171)
E/AndroidRuntime(5446): at android.content.ClipboardManager.setPrimaryClip(ClipboardManager.java:125)
E/AndroidRuntime(5446): at android.content.ClipboardManager.setText(ClipboardManager.java:208)
E/AndroidRuntime(5446): at com.google.android.apps.authenticator.AuthenticatorActivity.onContextItemSelected(AuthenticatorActivity.java:927)
E/AndroidRuntime(5446): at com.google.android.apps.authenticator.AuthenticatorActivity.access$200(AuthenticatorActivity.java:73)
E/AndroidRuntime(5446): at com.google.android.apps.authenticator.AuthenticatorActivity$3.onActionItemClicked(AuthenticatorActivity.java:353)
E/AndroidRuntime(5446): at android.widget.AbsListView$MultiChoiceModeWrapper.onActionItemClicked(AbsListView.java:6058)
E/AndroidRuntime(5446): at com.android.internal.policy.impl.PhoneWindow$DecorView$ActionModeCallbackWrapper.onActionItemClicked(PhoneWindow.java:2569)
E/AndroidRuntime(5446): at com.android.internal.app.ActionBarImpl$ActionModeImpl.onMenuItemSelected(ActionBarImpl.java:962)
E/AndroidRuntime(5446): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
E/AndroidRuntime(5446): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
E/AndroidRuntime(5446): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
E/AndroidRuntime(5446): at com.android.internal.view.menu.ActionMenuView.invokeItem(ActionMenuView.java:547)
E/AndroidRuntime(5446): at com.android.internal.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:115)
E/AndroidRuntime(5446): at android.view.View.performClick(View.java:4240)
E/AndroidRuntime(5446): at android.view.View$PerformClick.run(View.java:17721)
E/AndroidRuntime(5446): at android.os.Handler.handleCallback(Handler.java:730)
E/AndroidRuntime(5446): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(5446): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(5446): at android.app.ActivityThread.main(ActivityThread.java:5103)
E/AndroidRuntime(5446): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(5446): at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime(5446): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
E/AndroidRuntime(5446): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime(5446): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(431): Force finishing activity com.google.android.apps.authenticator2/com.google.android.apps.authenticator.AuthenticatorActivity
or similar. Once I disabled clipboard monitoring app and rebooted Nexus 7 the copying worked for sometime.
ad...@manichord.com <ad...@manichord.com> #8
[Comment deleted]
en...@google.com <en...@google.com>
[Deleted User] <[Deleted User]> #9
Yes, It's happening to my NEXUS 4 also. Once you launch any app monitoring clipboard then copying in any app crashes the app.
ad...@manichord.com <ad...@manichord.com> #10
i've noticed that even if app crashes, copying still works and I can paste copied data. So I've changed code in my app to:
public static void setClipData(Context context, String text) {
try {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("", text);
clipboard.setPrimaryClip(clip);
Toast.makeText(context.getApplicationContext(), R.string.url_copied, Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Toast.makeText(context.getApplicationContext(), R.string.url_copying_error, Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
But copying from contextual action bar still crashes and observing clipboard doesn't work at all. I think this is because ofhttp://www.androidpolice.com/2013/07/25/app-ops-android-4-3s-hidden-app-permission-manager-control-permissions-for-individual-apps/ :)
public static void setClipData(Context context, String text) {
try {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("", text);
clipboard.setPrimaryClip(clip);
Toast.makeText(context.getApplicationContext(), R.string.url_copied, Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Toast.makeText(context.getApplicationContext(), R.string.url_copying_error, Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
But copying from contextual action bar still crashes and observing clipboard doesn't work at all. I think this is because of
tr...@gmail.com <tr...@gmail.com> #11
I face the same issue on my Galaxy Nexus. I have an app "Clipper" (clipboard manager) running in background. The moment some text is copied from any app, that particular app would crash. After uninstalling app "Clipper" (a clipboard manager), the crashes stopped. I had to reboot after uninstalling.
da...@gmail.com <da...@gmail.com> #12
Could someone *please* post complete steps to reproduce. This means either:
(1) Attaching a complete code project that can be built and run to cause the problem to happen, or
(2) A pointer to an app on the play store to install with steps to reproduce in that app.
Thanks.
(1) Attaching a complete code project that can be built and run to cause the problem to happen, or
(2) A pointer to an app on the play store to install with steps to reproduce in that app.
Thanks.
[Deleted User] <[Deleted User]> #13
Diana Install https://play.google.com/store/apps/details?id=org.rojekti.clipper set it to have it monitoring in the notifaction bar then try copying anything from anywhere ;)
[Deleted User] <[Deleted User]> #14
As I mentioned here[1], it happens on pretty much any app, Google's included, in example:
1. Open YouTube (I have version 4.5.17).
2. Open a video (any video).
3. Overflow menu > Copy URL
Same with GMail:
1. Open GMail (I have version 4.5.2-714156).
2. Open a conversation
3. Long press on text to action bar mode to appear
4. Tap on copy action
1.https://plus.google.com/103638111379552295023/posts/hZMgjN2qSUU
1. Open YouTube (I have version 4.5.17).
2. Open a video (any video).
3. Overflow menu > Copy URL
Same with GMail:
1. Open GMail (I have version 4.5.2-714156).
2. Open a conversation
3. Long press on text to action bar mode to appear
4. Tap on copy action
1.
rn...@gmail.com <rn...@gmail.com> #15
Diane,
I've attached a sample application. Like I mentioned before, it's just a blank activity that attaches a listener to the clipboard service.
Once you've built, installed and run this application and its activity, simply open any other application and copy something. For example, open Google Search, type anything in the search bar, copy it and a crash will occur.
The important part here is that the copying must occur in _another application_ separate from the listener. This causes the uid mismatch in AppOpsService's verifyIncomingUid and throws an exception.
Alternatively, install the Clipper application linked in #13, complete the tutorial so that it registers a listener, and copy from any other application. A crash will occur.
I've attached a sample application. Like I mentioned before, it's just a blank activity that attaches a listener to the clipboard service.
Once you've built, installed and run this application and its activity, simply open any other application and copy something. For example, open Google Search, type anything in the search bar, copy it and a crash will occur.
The important part here is that the copying must occur in _another application_ separate from the listener. This causes the uid mismatch in AppOpsService's verifyIncomingUid and throws an exception.
Alternatively, install the Clipper application linked in #13, complete the tutorial so that it registers a listener, and copy from any other application. A crash will occur.
vm...@gmail.com <vm...@gmail.com> #16
[Comment deleted]
[Deleted User] <[Deleted User]> #17
In the SDK that I developed for the company I'm working for (http://docs.kontakt.io/android-sdk/2.0.0/quickstart/ ) we came up with forcing scan restart periodically. I implemented it as an optional "feature" because about a half of Android devices that I've had occasion to test the SDK against doesn't need the "force scan feature" to be configured.
However, there are ones that perform scan poorly and forcing scan helps in some way. It helps partially because starting/stopping scan is quite expensive operation and causes bluetooth to be jammed on some devices when working for a longer period (mostly on Android JELLY_BEAN_MR2 and KITKAT).
From our observations the following devices behave as expected in terms of bluetooth scan performance: Nexus 4, Nexus 5, Nexus 6, Samsung GS3, Samsung GS4, Samsung GS5.
Poor scan performance is observed on: Nexus 7, Samsung Galaxy Tab 4, Motorola Moto G.
The inconsistency in bluetooth scan performance was and really is annoying, we have plenty of issues in which the SDK-based applications suffer from that.
Some unifying solution should be provided.
The obvious one would be that the Android devices manufacturers should be provided with same bluetooth hardware working on same bluetooth stack to solve the issue.
However, there are ones that perform scan poorly and forcing scan helps in some way. It helps partially because starting/stopping scan is quite expensive operation and causes bluetooth to be jammed on some devices when working for a longer period (mostly on Android JELLY_BEAN_MR2 and KITKAT).
From our observations the following devices behave as expected in terms of bluetooth scan performance: Nexus 4, Nexus 5, Nexus 6, Samsung GS3, Samsung GS4, Samsung GS5.
Poor scan performance is observed on: Nexus 7, Samsung Galaxy Tab 4, Motorola Moto G.
The inconsistency in bluetooth scan performance was and really is annoying, we have plenty of issues in which the SDK-based applications suffer from that.
Some unifying solution should be provided.
The obvious one would be that the Android devices manufacturers should be provided with same bluetooth hardware working on same bluetooth stack to solve the issue.
ma...@android.com <ma...@android.com>
ca...@gmail.com <ca...@gmail.com> #18
Basically it happens with any app monitoring clipboard. 100% reproducible and very much easy to repro.
1) installhttps://play.google.com/store/apps/details?id=net.daum.android.dictionary
2) launch the app
3) launch or switch to other app(Chrome, Gmail, ''') which has texts can be copied to clipboard
4) copy text then the app crashes.
1) install
2) launch the app
3) launch or switch to other app(Chrome, Gmail, ''') which has texts can be copied to clipboard
4) copy text then the app crashes.
al...@classycode.com <al...@classycode.com> #19
Thanks for the help in reproducing! We now have a fix.
ei...@google.com <ei...@google.com>
ha...@gmail.com <ha...@gmail.com> #20
I am also having this issue on the n
New Nexus 7 (2013)
New Nexus 7 (2013)
Description
- On a Nexus 7 with Android 4.4.2 this callback is only invoked once when a new device is found. (although the logcat gets spammed with messages like:
I/bt-hci(7431): BLE HCI(id=62) event = 0x02)
I/bt-hci(7431): btu_ble_process_adv_pkt
I/bt-hci(7431): BLE HCI(id=62) event = 0x02)
I/bt-hci(7431): btu_ble_process_adv_pkt
etc.)
- On a Nexus 5 with Android 4.4.2 the callback is invoked constantly whenever a new advertising packet is found.
How can I achieve the same behaviour on the Nexus 7? Is it an Android bug?
(Btw: on the Galaxy I9300 with latest cyanogenmod the callback is invoked constantly whereas on the Xperia C6603 with the latest cyanogenmod it's only invoked once when a new device is found.)