~/.pam_environment

  1. Open "~/.pam_environment",
    LANGUAGE=ja_JP:zh_CN:en
    LANG=ja_JP.UTF-8
    LC_NUMERIC=ja_JP.UTF-8
    LC_TIME=ja_JP.UTF-8
    LC_MONETARY=ja_JP.UTF-8
    LC_PAPER=ja_JP.UTF-8
    LC_NAME=ja_JP.UTF-8
    LC_ADDRESS=ja_JP.UTF-8
    LC_TELEPHONE=ja_JP.UTF-8
    LC_MEASUREMENT=ja_JP.UTF-8
    LC_IDENTIFICATION=ja_JP.UTF-8
  2. wtf? "zh_CN"?
  3. I edited "LANGUAGE" line to,
    LANGUAGE=ja_JP:en
    

Screen freezed at "Checking battery state..." at startup of ubuntu 12.10.

  1. Open "/etc/default/grub" file.
    $ sudo vi /etc/default/grub
    
    Edit "GRUB_CMDLINE_LINUX_DEFAULT" like this,
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash console=tty1"
    
  2. Update grub settings.
    $ sudo update-grub
    
  3. Reboot system.
see also: http://ubuntuforums.org/showthread.php?t=1860674
see also: http://steadyassimilation.blogspot.jp/2012/04/note-ubuntu-1204lts.html

APK Expansion Files

Development environment.
  • Ubuntu 11.10 (Oneiric)
  • JDK 1.6.0_24-b07
  • Eclipse 3.7.3 (Indigo)
    • Android Development Toolkit 17.0.0

Preparing.
  1. Get a publisher account here for Google Play, if you don't have yet.
  2. Download two packages from the SDK Manager.('Google Play APK Expansion Library' and 'Google Play Licensing Library')
    Android SDK Manager
  3. Create two library projects from existing source.
    • <sdk>/extras/google/play_apk_expansion/downloader_library
    • <sdk>/extras/google/play_licensing/library
  4. Create a new project which you want to use APK Expansion Files and add above two library project to your new project's build path.
    Add a reference to a library project

Implementing.
  1. Downloader service.
    // Extends com.google.android.vending.expansion.downloader.impl.DownloaderService class and override three methods.
    public class ExpansionFileDownloaderService extends DownloaderService {
     // the Base64-encoded RSA public key for your publisher account
     private static final String PUBLIC_KEY = "{YOU_PUBLIC_KEY}";
     // Generate 20 random bytes, and put them here.
     private static final byte[] SALT = new byte[] {};
     @Override public String getPublicKey() {
      return PUBLIC_KEY;
     }
     @Override public byte[] getSALT() {
      return SALT;
     }
     @Override public String getAlarmReceiverClassName() {
      return ExpansionFileAlarmReceiver.class.getName();
     }
    }
    
  2. Alarm receiver.
    public class ExpansionFileAlarmReceiver extends BroadcastReceiver {
     @Override public void onReceive(Context context, Intent intent) {
      try {
       DownloaderClientMarshaller.startDownloadServiceIfRequired(
         context, intent, ExpansionFileDownloaderService.class);
      } catch (NameNotFoundException e) {
       Log.e("apk-expansion-files", "NameNotFoundException occurred. " + e.getMessage(), e);
      }
     }
    }
    
  3. Main activity.
    @Override
     public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      
      // Check whether the file have been downloaded.
      String mainFileName = Helpers.getExpansionAPKFileName(this, true, 1);
      boolean fileExists = Helpers.doesFileExist(this, mainFileName, 32921796L, false);
      if (!fileExists) {
       Intent launcher = getIntent();
       Intent fromNotification = new Intent(this, getClass());
       fromNotification.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
       fromNotification.setAction(launcher.getAction());
       if (launcher.getCategories() != null) {
        for (String cat : launcher.getCategories()) {
         fromNotification.addCategory(cat);
        }
       }
       PendingIntent pendingIntent = PendingIntent.getActivity(
         this, 0, fromNotification, PendingIntent.FLAG_UPDATE_CURRENT);
       try {
        // Start the download
        int result = DownloaderClientMarshaller.startDownloadServiceIfRequired(
          this, pendingIntent, ExpansionFileDownloaderService.class);
        if (DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED != result) {
         // implement Downloading UI.
         return;
        }
       } catch (NameNotFoundException e) {
        Log.e("apk-expansion-files", "NameNotFoundException occurred. " + e.getMessage(), e);
       }
      }
      // expansion file is available. start your application.
     }
    

Manifest declarations.
  • uses-permission
    <!-- Required to access Android Market Licensing -->
    <uses-permission android:name="com.android.vending.CHECK_LICENSE" />
    <!-- Required to download files from Android Market -->
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- Required to keep CPU alive while downloading files (NOT to keep screen awake) -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <!-- Required to poll the state of the network connection and respond to changes -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <!-- Required to check whether Wi-Fi is enabled -->
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <!-- Required to read and write the expansion files on shared storage -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    
  • application
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <service android:name=".ExpansionFileDownloaderService" android:label="@string/app_name" />
        <receiver android:name=".ExpansionFileAlarmReceiver" android:label="@string/app_name" />
    </application>
    

Testing APK Expansion Files
  1. Upload the application APK file and Expansion Files using the Google Play Developer Console.
    Uploading APK and Expansion file.
  2. Fill in the necessary application details. Click the Save button. Do not click Publish.
  3. Install the application on your test device and launch the app. Download will start soon.

android.widget.Toast.LENGTH_SHORT | LENGTH_LONG は何秒か?

実際、android.widget.Toast.LENGTH_SHORTとandroid.widget.Toast.LENGTH_LONGは何秒なのか?
  • com.android.server.NotificationManager#scheduleTimeoutLocked()
    private void scheduleTimeoutLocked(ToastRecord r, boolean immediate)
    {
        Message m = Message.obtain(mHandler, MESSAGE_TIMEOUT, r);
        long delay = immediate ? 0 : (r.duration == Toast.LENGTH_LONG ? LONG_DELAY : SHORT_DELAY);
        mHandler.removeCallbacksAndMessages(r);
        mHandler.sendMessageDelayed(m, delay);
    }
    
  • com.android.server.NotificationManager.LONG_DELAY, SHORT_DELAY
    private static final int LONG_DELAY = 3500; // 3.5 seconds
    private static final int SHORT_DELAY = 2000; // 2 seconds
    
  • 2秒と3.5秒なのかな?


see also: android.widget.Toast

make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libMesa_intermediates/src/glsl/linker.o] エラー1

android 最新ソースの make でコケた

こんなエラーメッセージが出て。。。
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libMesa_intermediates/src/glsl/linker.o] エラー1

環境
  • ubuntu 11.10 (64bit)
  • あとは全部ここに書いてあるビルド環境

エラーメッセージでググったらすぐ解決した

まあ、備忘録ってことで。(ここを参照のこと)
I'm hitting this too. The bug is the use of the offsetof() macro. Adding a "#include <stddef.h>" to linker.cpp fixes the issue for me.
とのことなので、
$ vi external/mesa3d/src/glsl/linker.cpp 
#include "main/shaderobj.h"

#include <stddef.h>

/**
 * Visitor that determines whether or not a variable is ever written.
 */
class find_assignment_visitor : public ir_hierarchical_visitor {
したら、一応最後まで走りましたよっと。