ActionBar added to framework, integrated with Activity and styles.
Added onClick attribute support to menus in MenuInflater.

Change-Id: I739771b4f249d87a0d8b15969f3d526b099067a1
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index aa3cb69..21c6d2a 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -16,14 +16,16 @@
 
 package android.app;
 
-import com.android.internal.policy.PolicyManager;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.HashMap;
 
 import android.content.ComponentCallbacks;
 import android.content.ComponentName;
 import android.content.ContentResolver;
 import android.content.Context;
-import android.content.Intent;
 import android.content.IIntentSender;
+import android.content.Intent;
 import android.content.IntentSender;
 import android.content.SharedPreferences;
 import android.content.pm.ActivityInfo;
@@ -50,6 +52,7 @@
 import android.util.EventLog;
 import android.util.Log;
 import android.util.SparseArray;
+import android.view.ActionBarView;
 import android.view.ContextMenu;
 import android.view.ContextThemeWrapper;
 import android.view.InflateException;
@@ -69,10 +72,10 @@
 import android.view.ViewGroup.LayoutParams;
 import android.view.accessibility.AccessibilityEvent;
 import android.widget.AdapterView;
+import android.widget.LinearLayout;
 
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.HashMap;
+import com.android.internal.app.SplitActionBar;
+import com.android.internal.policy.PolicyManager;
 
 /**
  * An activity is a single, focused thing that the user can do.  Almost all
@@ -650,6 +653,7 @@
     /*package*/ boolean mWindowAdded = false;
     /*package*/ boolean mVisibleFromServer = false;
     /*package*/ boolean mVisibleFromClient = true;
+    /*package*/ ActionBar mActionBar = null;
 
     private CharSequence mTitle;
     private int mTitleColor = 0;
@@ -1793,7 +1797,19 @@
     public View findViewById(int id) {
         return getWindow().findViewById(id);
     }
-
+    
+    /**
+     * Retrieve a reference to this activity's ActionBar.
+     * 
+     * <p><em>Note:</em> The ActionBar is initialized when a content view
+     * is set. This function will return null if called before {@link #setContentView}
+     * or {@link #addContentView}.
+     * @return The Activity's ActionBar, or null if it does not have one.
+     */
+    public ActionBar getActionBar() {
+        return mActionBar;
+    }
+    
     /**
      * Finds a fragment that was identified by the given id either when inflated
      * from XML or as the container ID when added in a transaction.  This only
@@ -1805,6 +1821,27 @@
     }
     
     /**
+     * Creates a new ActionBar, locates the inflated ActionBarView,
+     * initializes the ActionBar with the view, and sets mActionBar.
+     */
+    private void initActionBar() {
+        if (!getWindow().hasFeature(Window.FEATURE_ACTION_BAR)) {
+            return;
+        }
+        
+        ActionBarView view = (ActionBarView) findViewById(com.android.internal.R.id.action_bar);
+        if (view != null) {
+        	LinearLayout splitView = 
+        		(LinearLayout) findViewById(com.android.internal.R.id.context_action_bar);
+        	if (splitView != null) {
+        		mActionBar = new SplitActionBar(view, splitView);
+        	}
+        } else {
+            Log.e(TAG, "Could not create action bar; view not found in window decor.");
+        }
+    }
+    
+    /**
      * Set the activity content from a layout resource.  The resource will be
      * inflated, adding all top-level views to the activity.
      * 
@@ -1812,6 +1849,7 @@
      */
     public void setContentView(int layoutResID) {
         getWindow().setContentView(layoutResID);
+        initActionBar();
     }
 
     /**
@@ -1823,6 +1861,7 @@
      */
     public void setContentView(View view) {
         getWindow().setContentView(view);
+        initActionBar();
     }
 
     /**
@@ -1835,6 +1874,7 @@
      */
     public void setContentView(View view, ViewGroup.LayoutParams params) {
         getWindow().setContentView(view, params);
+        initActionBar();
     }
 
     /**
@@ -1846,6 +1886,7 @@
      */
     public void addContentView(View view, ViewGroup.LayoutParams params) {
         getWindow().addContentView(view, params);
+        initActionBar();
     }
 
     /**