Securing the Clipboard: Secure Copy and Paste on Android

BlackBerry Dynamics (BD) allows BlackBerry UEM administrators to prevent corporate data from leaking from apps by controlling copy and paste interactions.  An admin can set a policy to disable copying and pasting of data between a BD app and a non BD app.  This means a user could copy and paste from a BD app to another BD app (or within the same app) or between a non BD app and another non BD app, but not intermix the two.  Text copied between BD apps is also kept in encrypted form.

There are two methods a developer can use to implement secure copy and paste in a BD Android app, using the BD ClipboardManager or the BD Views.  Using the BD ClipboardManager is the more modern and recommended method of providing secure copy and paste in a BD app.

BlackBerry Dynamics ClipboardManager

The BD ClipboardManager class provides programmatic access to clipboard data, which may have been protected by BlackBerry Dynamics if required by enterprise policy. Clipboard data is used in cut, copy and paste operations as well as drag and drop interactions.

There are BD replacements for many methods in the native android.content.ClipboardManager programming interface.  There are also methods that can be used to implement drag and drop operations in a custom View class.

Copying Text

BD may secure or block text in transit to or from the clipboard, depending on the policies for data leakage prevention configured in BlackBerry UEM.  BD secures text by encrypting it when it is cut or copied to the device clipboard, and then decrypting it when it is pasted from the clipboard.

The methods in ClipboardManager will encrypt, decrypt, or block data as necessary, which the native methods do not.  The BD methods in ClipboardManager have the same names as their equivalent native methods.

Drag and Drop

An end user can transfer data within a mobile application, and between mobile applications, by using drag and drop operations.  The transfer of data by drag and drop may be secured or blocked by the BD. BD secures the payload data in a drag and drop interaction in the same way as clipboard data described above.  A custom View in an application that supports drag and drop operations can use the methods in this class in its implementation.

BlackBerry Dynamics Views

BD provides replacements for the many of the native android.widget.* classes, such as TextView and SearchView. BD applications can utilize these classes instead of the native classes in order to enable secure cut-copy-paste operations.  These classes have the same programming interface as the native classes.  Their names are prefixed with GD, such as GDTextView instead of TextView.

Most applications now make use of views from Android support libraries instead of the original native android.widget.* classes, which is why use of the BD ClipboardManager is the preferred option.

Try It Out Yourself

A sample app is included with the BlackBerry Dynamics SDK that demonstrates how to implement both approaches.  You can find it in the following directory:  


Have a look at that sample and let us know if you have any questions in the Android BlackBerry Dynamics Developer Forum.

Mark Sohm

About Mark Sohm

Senior Technical Solutions Manager on the Solution Architects team.

Mark Sohm joined BlackBerry in 2003 and currently works as a Senior Technical Solutions Manager on the Solutions Architects team. Mark Sohm has been helping developers create applications using BlackBerry technologies for over 15 years, starting way back with the very first BlackBerry JDK on BlackBerry OS 3.6 through to BlackBerry 10 and now Android with BlackBerry Dynamics and Android Enterprise.