This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package kotlin.coroutines | |
/** | |
* Persistent context for the coroutine. It is an indexed set of [Element] instances. | |
* An indexed set is a mix between a set and a map. | |
* Every element in this set has a unique [Key]. | |
*/ | |
@SinceKotlin("1.3") | |
public interface CoroutineContext { | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@file:OptIn(ExperimentalContracts::class) | |
package kotlinx.coroutines | |
import kotlinx.coroutines.internal.* | |
import kotlinx.coroutines.intrinsics.* | |
import kotlin.contracts.* | |
import kotlin.coroutines.* | |
import kotlin.coroutines.intrinsics.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code | |
public interface CoroutineScope { | |
/** | |
* The context of this scope. | |
* Context is encapsulated by the scope and used for implementation of coroutine builders that are extensions on the scope. | |
* Accessing this property in general code is not recommended for any purposes except accessing the [Job] instance for advanced usages. | |
* | |
* By convention, should contain an instance of a [job][Job] to enforce structured concurrency. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code | |
public fun <T> CoroutineScope.async( | |
context: CoroutineContext = EmptyCoroutineContext, | |
start: CoroutineStart = CoroutineStart.DEFAULT, | |
block: suspend CoroutineScope.() -> T | |
): Deferred<T> { | |
val newContext = newCoroutineContext(context) | |
val coroutine = if (start.isLazy) | |
LazyDeferredCoroutine(newContext, block) else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code | |
public fun CoroutineScope.launch( | |
context: CoroutineContext = EmptyCoroutineContext, | |
start: CoroutineStart = CoroutineStart.DEFAULT, | |
block: suspend CoroutineScope.() -> Unit | |
): Job { | |
val newContext = newCoroutineContext(context) | |
val coroutine = if (start.isLazy) | |
LazyStandaloneCoroutine(newContext, block) else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ClipboardService extends SystemService { | |
// Code | |
private class ClipboardImpl extends IClipboard.Stub { | |
// Code | |
@Override | |
public void setPrimaryClip(ClipData clip, String callingPackage, @UserIdInt int userId) { | |
synchronized (this) { | |
if (clip == null || clip.getItemCount() <= 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SystemService(Context.CLIPBOARD_SERVICE) | |
public class ClipboardManager extends android.text.ClipboardManager { | |
// Code | |
public void setPrimaryClip(@NonNull ClipData clip) { | |
try { | |
// Code | |
mService.setPrimaryClip(clip, mContext.getOpPackageName(), mContext.getUserId()); | |
} catch (RemoteException e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SystemService(Context.CLIPBOARD_SERVICE) | |
public class ClipboardManager extends android.text.ClipboardManager { | |
// Code | |
@UnsupportedAppUsage | |
void reportPrimaryClipChanged() { | |
// Code | |
synchronized (mPrimaryClipChangedListeners) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SystemService(Context.CLIPBOARD_SERVICE) | |
public class ClipboardManager extends android.text.ClipboardManager { | |
// Code | |
private final IOnPrimaryClipChangedListener.Stub mPrimaryClipChangedServiceListener | |
= new IOnPrimaryClipChangedListener.Stub() { | |
@Override | |
public void dispatchPrimaryClipChanged() { | |
mHandler.post(() -> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SystemService(Context.CLIPBOARD_SERVICE) | |
public class ClipboardManager extends android.text.ClipboardManager { | |
// Code | |
public void addPrimaryClipChangedListener(OnPrimaryClipChangedListener what) { | |
// Code | |
mService.addPrimaryClipChangedListener( | |
mPrimaryClipChangedServiceListener, mContext.getOpPackageName(), | |
mContext.getUserId()); |
NewerOlder