Adding support for requesting addition of shortcut/widget
on the workspace.

Bug: 33584624
Change-Id: I664366822fe8088742faff2cce006239ab0771bc
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index fc112f3..13534b9 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -22,7 +22,6 @@
 import android.animation.ValueAnimator;
 import android.annotation.SuppressLint;
 import android.annotation.TargetApi;
-import android.app.Activity;
 import android.app.ActivityOptions;
 import android.app.AlertDialog;
 import android.app.SearchManager;
@@ -42,7 +41,6 @@
 import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
-import android.content.res.Configuration;
 import android.database.sqlite.SQLiteDatabase;
 import android.graphics.Point;
 import android.graphics.Rect;
@@ -136,7 +134,7 @@
 /**
  * Default launcher application.
  */
-public class Launcher extends Activity
+public class Launcher extends BaseActivity
         implements LauncherExterns, View.OnClickListener, OnLongClickListener,
                    LauncherModel.Callbacks, View.OnTouchListener, LauncherProviderChangeListener,
                    AccessibilityManager.AccessibilityStateChangeListener {
@@ -194,7 +192,7 @@
 
     private boolean mIsSafeModeEnabled;
 
-    static final int APPWIDGET_HOST_ID = 1024;
+    public static final int APPWIDGET_HOST_ID = 1024;
     public static final int EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT = 500;
     private static final int ON_ACTIVITY_RESULT_ANIMATION_DELAY = 500;
     private static final int ACTIVITY_START_DELAY = 1000;
@@ -273,8 +271,6 @@
     // it from the context.
     private SharedPreferences mSharedPrefs;
 
-    private DeviceProfile mDeviceProfile;
-
     private boolean mMoveToDefaultScreenFromNewIntent;
 
     // This is set to the view that launched the activity that navigated the user away from
@@ -359,11 +355,7 @@
         LauncherAppState app = LauncherAppState.getInstance(this);
 
         // Load configuration-specific DeviceProfile
-        mDeviceProfile =
-                getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
-                        ? app.getInvariantDeviceProfile().landscapeProfile
-                        : app.getInvariantDeviceProfile().portraitProfile;
-
+        mDeviceProfile = app.getInvariantDeviceProfile().getDeviceProfile(this);
         if (Utilities.ATLEAST_NOUGAT && isInMultiWindowMode()) {
             Display display = getWindowManager().getDefaultDisplay();
             Point mwSize = new Point();
@@ -1657,10 +1649,6 @@
         return mSharedPrefs;
     }
 
-    public DeviceProfile getDeviceProfile() {
-        return mDeviceProfile;
-    }
-
     @Override
     protected void onNewIntent(Intent intent) {
         long startTime = 0;