Revert the open-source LatinIME package name -
 from com.google.android.inputmethod.latin to com.android.inputmethod.latin

Related change: https://android-git.corp.google.com/g/60862

bug: 2786392

Change-Id: Ib7c6cfe61db19ef50c401a01497eef5f1f5e239e
diff --git a/java/Android.mk b/java/Android.mk
index 0d5a93d..4bb8986 100755
--- a/java/Android.mk
+++ b/java/Android.mk
@@ -14,20 +14,9 @@
 LOCAL_STATIC_JAVA_LIBRARIES := android-common
 
 #LOCAL_AAPT_FLAGS := -0 .dict
-# The following flag is required because we use a different package name
-# com.google.android.inputmethod.latin than Java package name
-# com.android.inputmethod.latin
-LOCAL_AAPT_FLAGS := --custom-package com.android.inputmethod.latin
 
-LOCAL_SDK_VERSION := 8
+LOCAL_SDK_VERSION := current
 
 LOCAL_PROGUARD_FLAGS := -include $(LOCAL_PATH)/proguard.flags
 
-# Define LOCAL_DICTIONARY_RESOURCE_DIR in order to overlay dictionaries.
-# The overlay dictionary resource directory should have dictionary files such
-# as raw-en/main.dict, raw-es/main.dict per locale.
-ifneq ($(strip $(LOCAL_DICTIONARY_RESOURCE_DIR)),)
-LOCAL_RESOURCE_DIR := $(LOCAL_DICTIONARY_RESOURCE_DIR) $(LOCAL_PATH)/res
-endif
-
 include $(BUILD_PACKAGE)
diff --git a/java/AndroidManifest.xml b/java/AndroidManifest.xml
index f87ce01..642c717 100755
--- a/java/AndroidManifest.xml
+++ b/java/AndroidManifest.xml
@@ -1,7 +1,5 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-        package="com.google.android.inputmethod.latin">
-
-    <original-package android:name="com.android.inputmethod.latin" />
+        package="com.android.inputmethod.latin">
 
     <uses-permission android:name="android.permission.VIBRATE"/>
     <uses-permission android:name="android.permission.READ_USER_DICTIONARY" />
@@ -10,10 +8,10 @@
     <uses-permission android:name="android.permission.READ_CONTACTS" />
 
     <application android:label="@string/english_ime_name"
-            android:backupAgent="com.android.inputmethod.latin.LatinIMEBackupAgent"
+            android:backupAgent="LatinIMEBackupAgent"
             android:killAfterRestore="false">
 
-        <service android:name="com.android.inputmethod.latin.LatinIME"
+        <service android:name="LatinIME"
                 android:label="@string/english_ime_name"
                 android:permission="android.permission.BIND_INPUT_METHOD">
             <intent-filter>
@@ -22,13 +20,13 @@
             <meta-data android:name="android.view.im" android:resource="@xml/method" />
         </service>
 
-        <activity android:name="com.android.inputmethod.latin.LatinIMESettings" android:label="@string/english_ime_settings">
+        <activity android:name="LatinIMESettings" android:label="@string/english_ime_settings">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN"/>
             </intent-filter>
         </activity>
 
-        <activity android:name="com.android.inputmethod.latin.InputLanguageSelection"
+        <activity android:name="InputLanguageSelection"
                 android:label="@string/language_selection_title">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN"/>
diff --git a/java/res/layout/input_basic.xml b/java/res/layout/input_basic.xml
index ffa5954..168eba6 100755
--- a/java/res/layout/input_basic.xml
+++ b/java/res/layout/input_basic.xml
@@ -20,7 +20,7 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
-        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
+        xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
         android:id="@+id/LatinkeyboardBaseView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
diff --git a/java/res/layout/input_basic_highcontrast.xml b/java/res/layout/input_basic_highcontrast.xml
index dc4d097..19ff1db 100755
--- a/java/res/layout/input_basic_highcontrast.xml
+++ b/java/res/layout/input_basic_highcontrast.xml
@@ -20,7 +20,7 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
-        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
+        xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
 
         android:id="@+id/LatinkeyboardBaseView"
         android:layout_alignParentBottom="true"
diff --git a/java/res/layout/input_stone_bold.xml b/java/res/layout/input_stone_bold.xml
index d6c03cc..e3588bb 100755
--- a/java/res/layout/input_stone_bold.xml
+++ b/java/res/layout/input_stone_bold.xml
@@ -20,7 +20,7 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
-        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
+        xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
         android:id="@+id/LatinkeyboardBaseView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
diff --git a/java/res/layout/input_stone_normal.xml b/java/res/layout/input_stone_normal.xml
index 2c39bb1..fd7bf85 100755
--- a/java/res/layout/input_stone_normal.xml
+++ b/java/res/layout/input_stone_normal.xml
@@ -20,7 +20,7 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
-        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
+        xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
         android:id="@+id/LatinkeyboardBaseView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
diff --git a/java/res/layout/input_stone_popup.xml b/java/res/layout/input_stone_popup.xml
index b6894b6..1efa56c 100755
--- a/java/res/layout/input_stone_popup.xml
+++ b/java/res/layout/input_stone_popup.xml
@@ -26,7 +26,7 @@
         android:background="@drawable/keyboard_popup_panel_background"
         >
     <com.android.inputmethod.latin.LatinKeyboardBaseView
-            xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
+            xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
             android:id="@+id/LatinKeyboardBaseView"
             android:layout_alignParentBottom="true"
             android:layout_width="match_parent"
diff --git a/java/res/layout/input_trans.xml b/java/res/layout/input_trans.xml
index ee5f85e..4c0979c 100755
--- a/java/res/layout/input_trans.xml
+++ b/java/res/layout/input_trans.xml
@@ -20,7 +20,7 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
-        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
+        xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
         android:id="@android:id/keyboardView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
diff --git a/java/res/layout/keyboard_popup_keyboard.xml b/java/res/layout/keyboard_popup_keyboard.xml
index 5f8a03d..a1b571a 100644
--- a/java/res/layout/keyboard_popup_keyboard.xml
+++ b/java/res/layout/keyboard_popup_keyboard.xml
@@ -25,7 +25,7 @@
         android:background="@drawable/keyboard_popup_panel_background"
         >
     <com.android.inputmethod.latin.LatinKeyboardBaseView
-            xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
+            xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
             android:id="@+id/LatinKeyboardBaseView"
             android:layout_alignParentBottom="true"
             android:layout_width="match_parent"
diff --git a/java/src/com/android/inputmethod/latin/InputLanguageSelection.java b/java/src/com/android/inputmethod/latin/InputLanguageSelection.java
index 923dce3..4f67227 100644
--- a/java/src/com/android/inputmethod/latin/InputLanguageSelection.java
+++ b/java/src/com/android/inputmethod/latin/InputLanguageSelection.java
@@ -100,7 +100,7 @@
         conf.locale = locale;
         res.updateConfiguration(conf, res.getDisplayMetrics());
 
-        int[] dictionaries = LatinIME.getDictionary(res, this.getPackageName());
+        int[] dictionaries = LatinIME.getDictionary(res);
         BinaryDictionary bd = new BinaryDictionary(this, dictionaries, Suggest.DIC_MAIN);
 
         // Is the dictionary larger than a placeholder? Arbitrarily chose a lower limit of
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index ace0b08..3073384 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -394,7 +394,8 @@
      * Loads a dictionary or multiple separated dictionary
      * @return returns array of dictionary resource ids
      */
-    static int[] getDictionary(Resources res, String packageName) {
+    static int[] getDictionary(Resources res) {
+        String packageName = LatinIME.class.getPackage().getName();
         XmlResourceParser xrp = res.getXml(R.xml.dictionary);
         int dictionaryCount = 0;
         ArrayList<Integer> dictionaries = new ArrayList<Integer>();
@@ -443,7 +444,7 @@
         SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
         mQuickFixes = sp.getBoolean(PREF_QUICK_FIXES, true);
 
-        int[] dictionaries = getDictionary(orig, this.getPackageName());
+        int[] dictionaries = getDictionary(orig);
         mSuggest = new Suggest(this, dictionaries);
         updateAutoTextEnabled(saveLocale);
         if (mUserDictionary != null) mUserDictionary.close();
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 66cecee..210e814 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -27,7 +27,7 @@
     </application>
 
     <instrumentation android:name="android.test.InstrumentationTestRunner"
-        android:targetPackage="com.google.android.inputmethod.latin"
+        android:targetPackage="com.android.inputmethod.latin"
         android:label="LatinIME tests">
     </instrumentation>
 </manifest>